SpringBoot and EclipseScout [message #1748176] |
Sun, 20 November 2016 11:24  |
Eclipse User |
|
|
|
Hi there,
I just cloned the SpringBoot-and-EclipseScout POC and had a look at it.
I like the possibility to use the Scout UI and Spring Boot together very much. Mainly because Spring (Boot) JPA doesn't require to write cumbersome and error prone SQL statements.
But looking at the sample code a few questions came up:
- Can I still use the possibility of the @RestController? Because in the code there is the TaskController which has a @RequestMapping(ScoutServletConfig.SERVICES_PATH + "/tasks"). But invoking localhost:8080/api/tasks throws an error because it's not found. Any idea why? Has it something to do with the ScoutServletConfig? Althoug during startup it says: Mapped "{[/api/tasks || /api/tasks/]}" onto public java.util.Collection...
- Why are there two Objects used? E.g. Task and TaskEntity? Isn't it possible to use just one Task (DTO)-Object throughout the whole code? At the moment values from Task are copied to TaskEntity and vice versa and then copied to the according form model. Why?
- Would it possible to use a multi-module project setup? Right now it's just one project, which covers all. What would the configuration look like, if I'd like to split the project into several small sub projects?
- When using Spring (Boot) JPA combined with the Scout UI Layer, right now the values from DTO have to be copied manually to the form beans. Is there also some kind of generic way to achieve this?
- How can LookupCalls be implemented when using Spring (Boot) JPA?
Thanks in advance
Peter
[Updated on: Sun, 20 November 2016 18:17] by Moderator Report message to a moderator
|
|
|
Re: SpringBoot and EclipseScout [message #1748199 is a reply to message #1748176] |
Mon, 21 November 2016 08:09   |
Eclipse User |
|
|
|
hi peter
first some overall remarks regarding the combination of Spring Boot and Scout:
- this is still work in progress, after accepting a pull request some things have to be fixed again and some things are now much nicer 
- the goal is to have a sample repo by the end of the year that can be seen as "best practice" from both the Scout and the Spring perspective
- an additional goal is to create a maven archetype for the Scout/SpringBoot combination
now, some more specific answers:
(a) @RestController: it is definitively the idea that this works
(b) Why two classes?: this is open for debate: on one side we want to take advantage of JPA (this leads to hibernate beans, eg. TaskEntity) and on the other side we want the business services to hide the fact that we are dealing with some specific persistance technology (eg. Task).
(c) Why no multi-module project?: this is open for debate too. so far we came to favor a single-module approach for the following reasons: for smaller apps creating a multi-module application creates is overkill, for developers with a SpringBoot background the setup more closely matches the Spring hello world setup
(d) Why a manual copy from JPA objects to form beans?: no reason so far, what is your recommendation to use instead (simpler approaches with fewer dependencies are more favorable ...)
(e) LookupCalls and SpringBoot JPA: we will try to come up with example for that
tx for your interest and questions. it would be great to have as many people challenging and contributing to this
|
|
|
Re: SpringBoot and EclipseScout [message #1748207 is a reply to message #1748199] |
Mon, 21 November 2016 08:46   |
Eclipse User |
|
|
|
Hi,
Matthias Zimmermann wrote on Mon, 21 November 2016 08:09
first some overall remarks regarding the combination of Spring Boot and Scout:
- this is still work in progress, after accepting a pull request some things have to be fixed again and some things are now much nicer 
- the goal is to have a sample repo by the end of the year that can be seen as "best practice" from both the Scout and the Spring perspective
- an additional goal is to create a maven archetype for the Scout/SpringBoot combination
That sounds very good. I'm looking forward seeing such a best practice example.
Matthias Zimmermann wrote on Mon, 21 November 2016 08:09
(a) @RestController: it is definitively the idea that this works
Should this work already? Because I just get an 404 error (mapping not found) and a breakpoint there isn't invoked either.
Matthias Zimmermann wrote on Mon, 21 November 2016 08:09
(c) Why no multi-module project?: this is open for debate too. so far we came to favor a single-module approach for the following reasons: for smaller apps creating a multi-module application creates is overkill, for developers with a SpringBoot background the setup more closely matches the Spring hello world setup
I agree. For smaller projects it's more than sufficient. But nevertheless an example you how a multi-module project setup would look like, would be very cool.
Matthias Zimmermann wrote on Mon, 21 November 2016 08:09
(d) Why a manual copy from JPA objects to form beans?: no reason so far, what is your recommendation to use instead (simpler approaches with fewer dependencies are more favorable ...)
Would tools like ModelMapper be a valid approach here?
Matthias Zimmermann wrote on Mon, 21 November 2016 08:09
(e) LookupCalls and SpringBoot JPA: we will try to come up with example for that
Yes please. That would be wonderful.
I started to migrate my RAP based Scout Project to Scout/SpringBoot this weekend by copying your sample project and adjusting it to my needs. My deadline for this new version is spring 2017. So there is no need to hurry and I'll keep an eye on the git regulary. But I'd be more than happy if the Scout/SpringBoot path would be pushed forward as far as and as quick as possible.
Thanks
Peter
[Updated on: Mon, 21 November 2016 08:47] by Moderator Report message to a moderator
|
|
|
Re: SpringBoot and EclipseScout [message #1748771 is a reply to message #1748207] |
Mon, 28 November 2016 14:16   |
Eclipse User |
|
|
|
HI,
I have seen, that you have pushed new changes to the eclipsescout/spring boot sample app.
Why did you remove the lombok support?
I have seen that you have started with a LookupCall implementation. Does this right now always fetch all entities from the desired table?
Peter
|
|
|
Re: SpringBoot and EclipseScout [message #1748987 is a reply to message #1748771] |
Wed, 30 November 2016 19:36   |
Eclipse User |
|
|
|
> Why did you remove the lombok support?
this boils down to the following two items
- pros and cons to keep the dependency had roughly the same weight
- we had some complaints from colleagues that did not like the fact that they would have to lombok-ify their eclipse ide to work with the repo.
> lookup calls
there are two lookup calls now:
- LocaleLookupCall this makes sense to keep in memory
- UserLookupCall for many users it would make sense to not load all data. this would need some additional coding
other points worth mentioning that have been updated in the github repo:
- the app now works with hashed passwords
- we have started to integrate the model mapper suggested by you. let's see how this turns out ...
|
|
|
Re: SpringBoot and EclipseScout [message #1749053 is a reply to message #1748987] |
Thu, 01 December 2016 13:47   |
Eclipse User |
|
|
|
Hi Matthias,
I've seen it already I like the Scout/SpringBoot combination very much So much less SQL boilerplate code 
I've got another requirement popping up in my mind: How would be a user registration dialog be implemented in that scenario?
Peter
|
|
|
|
|
Re: SpringBoot and EclipseScout [message #1750378 is a reply to message #1749121] |
Tue, 20 December 2016 14:12   |
Eclipse User |
|
|
|
The demo repo for the integration of Spring Boot and Eclipse Scout has reached a good intermediate state, plus some documentation. Please consider to evaulate what you see and let us know what you think. The new readme also contains a roadmap for potential extensions.
The organization of the code base is described in the Maven module readme.
ps. @Peter: tx for the wireframe for the login form (I've added this point to the "roadmap" too)
|
|
|
|
Re: SpringBoot and EclipseScout [message #1750715 is a reply to message #1750433] |
Tue, 27 December 2016 07:08   |
Eclipse User |
|
|
|
Hi there,
happy XMas to all of you 
@Matthias: I played around a little bit with your code and tried to adjust it to my needs. I like the way you incorperated the ModelMapper But there I have a question:
In all of your entities you use a UUID to identify the objects/records uniquely.In my case I have to access a legacy database with ordinary primary keys with a @NonNull annotation. When creating a new record, the primary key in the object model is of course null, since the PK will be created upon inserting into the database. But that's exactly the point, where ModelMapper complains about setting a null value.
Is there a way to tell ModelMapper only in the case of inserting a new record, to ignore the null value?
Thanks a lot
Peter
|
|
|
|
|
|
Re: SpringBoot and EclipseScout [message #1751563 is a reply to message #1751562] |
Wed, 11 January 2017 14:02   |
Eclipse User |
|
|
|
Hi Matthias,
thanks for your help:)
There is another question: I'm quite new to maven and I have problems to build this spring boot application.
Are there any specific steps needed other than "Run -> Maven build..."?
Thanks
Peter
|
|
|
Re: SpringBoot and EclipseScout [message #1751620 is a reply to message #1751563] |
Wed, 11 January 2017 22:57   |
Eclipse User |
|
|
|
i couldn't find any problems. this is what i tried:
1) in the package explorer of the eclipse ide: use context menu run -> maven build ... (using "clean package" in the goals field)
2) on the command line: mvn clean install (in the directory of the pom.xml file) i even started from scratch with with git clone
in all cases i got a "build success" from maven and the fat jar files in the target directory. you could maybe try the approach 2) from above and share the error messages you get?
|
|
|
Re: SpringBoot and EclipseScout [message #1751637 is a reply to message #1751620] |
Thu, 12 January 2017 07:30   |
Eclipse User |
|
|
|
Hi,
Matthias Zimmermann wrote on Wed, 11 January 2017 22:57
1) in the package explorer of the eclipse ide: use context menu run -> maven build ... (using "clean package" in the goals field)
2) on the command line: mvn clean install (in the directory of the pom.xml file) i even started from scratch with with git clone ?
thanks. I missed the clean package.
Now it Works.
Peter
|
|
|
Re: SpringBoot and EclipseScout [message #1752406 is a reply to message #1751637] |
Mon, 23 January 2017 13:29   |
Eclipse User |
|
|
|
Hi there,
I was wandering if some one can help me with a ModelMapper problem? 
I have got 2 Entites...
CountyEntity and ForrestHelperEntity.
The CountyEntity has got a List of ForrestHelperEntities and the ForrestHelperEntity has got a reference to CountyEntity....
And now when using the ModelMapper to Map between DAOs and Entites I get into an Infinite Loop. Because when starting to map the County-Objects all ForrestHelper Objects (the Set/List) will also be mapped. And for every ForrestHelper the referenced County Object will be mapped... But the County object does have the Set/List of ForrestHelper objects....
So this never comes to an end...
Does anyone have experience how to map parent - child relations with ModelMapper?
Thanks
Peter
|
|
|
Re: SpringBoot and EclipseScout [message #1752436 is a reply to message #1752406] |
Mon, 23 January 2017 17:59   |
Eclipse User |
|
|
|
Hi Peter
Besides that ModelMapper has no mechanism for detecting/handling circular references, I'm not sure if you want to load/map multiple entities with just one service call anyway. (Note that we're using ModelMapper mainly to unproxy the JPA-entities from Spring Data, see https://github.com/jhalterman/modelmapper/blob/master/core/src/main/java/org/modelmapper/internal/util/Types.java#L53)
Imagine a County-LookupCall which resolves a display name for a specific county-id by loading the county DTO bean. There will be no need to look up and load the full DTO object for each forest of that country...
IMHO you should consider to move towards separate service methods for dealing with the county-forest relation (getForestsOfCounty(countyId), getCountyOfForest(forestId)), or at least only embed the forest ids into counties and vice versa.
|
|
|
Re: SpringBoot and EclipseScout [message #1752470 is a reply to message #1752436] |
Tue, 24 January 2017 08:20   |
Eclipse User |
|
|
|
Hi Michael,
I assume I worked around your concerns that way, that i skip the child collection properties with a specifica PropertyMap when not needed... They aren't loaded as long they are not needed. If I understood your concerns correctly.
Peter
|
|
|
|
Re: SpringBoot and EclipseScout [message #1753423 is a reply to message #1753422] |
Mon, 06 February 2017 09:43   |
Eclipse User |
|
|
|
Hi there,
I changed the scout version in my pom.xml to
<scout.version>6.1.0.M5</scout.version>
and now i get
UiHttpSessionListener cannot be resolved to a type
Is this a regression or was the UiHttpSessionListener just skipped?
Thanks, Peter
|
|
|
|
Re: SpringBoot and EclipseScout [message #1753443 is a reply to message #1753431] |
Mon, 06 February 2017 14:55   |
Eclipse User |
|
|
|
Thanks. That fixed my compilation problem.
Now the login screen remains empty. I guess that has something to do with "Reorganized *.html files due to strict CSP rules" form the migration guide?
login.js:2 Uncaught TypeError: Cannot read property 'init' of undefined
at HTMLDocument.<anonymous> (login.js:2)
at fire (jquery-all.js:3100)
at Object.fireWith [as resolveWith] (jquery-all.js:3212)
at Function.ready (jquery-all.js:3418)
at HTMLDocument.completed (jquery-all.js:3434)
|
|
|
|
Re: SpringBoot and EclipseScout [message #1754664 is a reply to message #1753447] |
Tue, 21 February 2017 11:51   |
Eclipse User |
|
|
|
Hi there,
I just pulled the new version from githun where Spring Security was integrated.
Unfortunately now the login doesn't seem to work any more. I put a breakpoint at org.eclipse.scout.tasks.spring.security.DefaultUserDetailsService.loadUserByUsername(String) and had a look what was happening there. And it seems, that the username isn't transfered from the login page to this method. The username is just empty.
Is the username not transfered from the login dialog to the server?
What I also encountered are these log entries:
2017-02-21 12:45:18.020 WARN 20888 --- [nio-8080-exec-2] o.e.s.r.u.html.script.ScriptFileLocator : locate /res/spring-security-module.less: does not exist (no library, macro or source module)
2017-02-21 12:45:18.048 WARN 20888 --- [nio-8080-exec-4] o.e.s.r.u.html.script.ScriptFileLocator : locate /res/spring-security-module.js: does not exist (no library, macro or source module)
May this be the problem?
Regards,
Peter
|
|
|
|
Re: SpringBoot and EclipseScout [message #1754844 is a reply to message #1754770] |
Thu, 23 February 2017 06:25   |
Eclipse User |
|
|
|
Hi Michael,
thanks that helped... BUT 
I tried to migrate and adapt all the files - which you have changed in your example project - in my small test project. And now I get this exception during application startup:
Config property with key 'scout.auth.permission.exclude' does not exist or has an invalid value.
I changed my config.properties according to yours:
scout.auth.permission.exclude=\
org.eclipse.scout.rt.shared.security.CreateGlobalBookmarkPermission,\
org.eclipse.scout.rt.shared.security.ReadGlobalBookmarkPermission,\
org.eclipse.scout.rt.shared.security.UpdateGlobalBookmarkPermission,\
org.eclipse.scout.rt.shared.security.DeleteGlobalBookmarkPermission,\
org.eclipse.scout.rt.shared.security.CreateUserBookmarkPermission,\
org.eclipse.scout.rt.shared.security.ReadUserBookmarkPermission,\
org.eclipse.scout.rt.shared.security.UpdateUserBookmarkPermission,\
org.eclipse.scout.rt.shared.security.DeleteUserBookmarkPermission,\
org.eclipse.scout.rt.shared.security.PublishUserBookmarkPermission,\
org.eclipse.scout.rt.shared.security.CreateCustomColumnPermission,\
org.eclipse.scout.rt.shared.security.UpdateCustomColumnPermission,\
org.eclipse.scout.rt.shared.security.DeleteCustomColumnPermission,\
org.eclipse.scout.rt.shared.security.ReadDiagnosticServletPermission,\
org.eclipse.scout.rt.shared.security.UpdateDiagnosticServletPermission,\
org.eclipse.scout.rt.shared.security.RemoteServiceAccessPermission,\
org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission,\
Bit it seems that I missed something (again)... Can you please point me to the right direction?
Does the attached pom.xml help?
Thx
Peter
Attachment: pom.xml
(Size: 5.53KB, Downloaded 197 times)
[Updated on: Thu, 23 February 2017 06:29] by Moderator Report message to a moderator
|
|
|
|
Re: SpringBoot and EclipseScout [message #1754853 is a reply to message #1754851] |
Thu, 23 February 2017 09:03   |
Eclipse User |
|
|
|
Hi,
i'm able to startup the application and display the login screen, when I remove the scout.auth.permission.exclude from the config file.
I'll have a look at the PermissionService and come back to you.
Peter
|
|
|
|
Re: SpringBoot and EclipseScout [message #1755902 is a reply to message #1754864] |
Thu, 09 March 2017 08:46   |
Eclipse User |
|
|
|
Hi there,
recently I had some time to play around again with the new version of Scout/SpringBoot and there I found 2 things, which I don't understand.
- /src/main/js
There is a folder called "tasks", which i assume is called because of the "Tasks" application name. I wanted to rename this folder to my application name. The question is, can I just do a plain search/replace in all *.js and *.less files and nothing breaks?
- PasswordEncoder
Since I want to migrate my Scout Mars application to Scout Neon/SpringBoot, I will have to use the password encoding mechanism I used in Mars, since I have already 29.000 user accounts there. Is there a way, that I can integrate the generated salt and hash from the old password in an own PasswordEncoder? Are there any examples?
Any ideas how this can be handled?
Thanks
Peter
|
|
|
Re: SpringBoot and EclipseScout [message #1758178 is a reply to message #1755902] |
Fri, 24 March 2017 10:40   |
Eclipse User |
|
|
|
hi peter
we are in the process to completely move to spring security. with this move the password encoding will be gone. basically this then allows for the following options: keep the existing security that uses the encoder and some scout components - or - migration to the spring based security. most likely, you want to check out the new state that will plan to push to the repo next week.
best regards
matthias
|
|
|
Re: SpringBoot and EclipseScout [message #1758233 is a reply to message #1758178] |
Sat, 25 March 2017 11:55  |
Eclipse User |
|
|
|
Hi Matthias,
of course I'd like to check out your progress. I'm eager to have a look at it
By the way I have 3 more questions, where I can't get my head around:
- regarding ModelMapper: How to you handle circular references in your object models? E.g. There is a Customer who is assigned to a County, And the County on itself has a 1:n relation to Customers... Modelmapper then recursively tries to map all attributes/objects which in the end leads to a stack overflow exception. This especially happens in overview pages. Which approach do you choose? Do you define dedicated Overview Entities with dedicated Overview DTO where you try to skip such relations or are you using a special mapping configuration in such cases? Are there any
- regarding EH Cache or any other cache for LookupCalls: what are your thoughts about integrating such a cache mechanism for LookupCalls or are there any other possibilities where such a cache would make sense?
- regarding Hibernate Search/ElasticSearch: since it's very easy to integrate Hibernate Search/ElasticSearch with SpringBoot, where and when does in your opinion such an integration make sense?
Thanks a lot, I know I have a lot of questions 
Peter
|
|
|