I am writing new application. For client side I would like to have newest gwt 2.7, but for server side code I would like to use Spring4 (firstly spring security and spring data).
Can anyone tell how it is now with integrating those 2 frameworks. I can not find any new tutorial/ information about state of integration in newest versions of those frameworks. Is there still mandatory some kind of framework: like spring4gwt or gwtrpc-spring?
I consider to use Request Factory and GWT RPC for ajax comunication, but I would like to avoid xml's as much as I can. I prefer type safe way, aka using java class. I also use tomcat7 and maven.
I am open to any sugestion. Please help.
I recently tried spring boot on the server side and GWT on the client side and it works like a charm.
You have to throw away the RPC stuff and just use REST services. To do this we use the Resty GWT library and Spring Rest Controller. This also allows us the decouple GWT from the backend and switch it with other technologies if necessary.
Related
My framework is spring framework. core version is 4.3.16.RELEASE.
Not using springboot. It's one of the legacy project.
And I wanna know what can I use the feign client without springboot.
Is this possible? and where can I found document about that.
thanks for your help :)
Yes, it's possible. You can find the documentation on their Github page.
Feign wasn't integrated with Spring initially. There is another wrapper library called Spring Cloud OpenFeign, and with it, you can use Feign in Spring Boot & Cloud applications more convenient (eg., you can use Spring's #RequestMapping annotation instead of default Feign's #RequestLine).
I want to know what spring dependencies should I use on my website to make the work easy and spring or spring boot which one is better. also, suggest some frontend technologies that I can use to make the website smart.
It's a very broad question. And it all depends on what features you want in your web site. Just listing few basic module to give you some hints.
Spring MVC - For web application with MVC Pattern
Spring Security - To secure your app
Spring ORM - If using any ORM tool like hibernate
You need to explore more on the basis of your need.
Spring Boot vs Spring:
You should use Spring Boot if you are starting new project. Spring Boot came to make development process easier when using Spring Framework. In Spring, developer had to write lots of code to configure beans and dependencies. Spring Boot automated this process so that you no longer do it by yourself but Spring Boot will take care of it. Plus it provides some extra tools (In built Web Server, in Memory DB, tool to monitor and manage Spring Boot App )
Try to create a simple web app in Spring and Spring Boot to understand the difference.
Front-end Technologies:
JavaScript based framework/lib like Angular,React,Vue etc. are the trend for front-end now a days. Again there are pros and cons of each of them. Hence you need to evaluate, what suits you better as per your requirement.
I'm analyzing on using Spring framework with Play 2.1 to support DI. Apart from DI, can i also use spring's AOP interceptors, transaction, DAO and REST support with Play 2.1? I'm not sure whether it is the right approach. If not, what is the best way to handle these things with Play? Are there any inbuilt support in Play on these areas or do i need to go with separate libraries like AspectJ, Guice, Jersey etc?
Yes you can integrate Spring with the Play Framework. I did it in a project just some weeks ago. As shown in the tutorial linked by Pere Villega this can easily be achived by extending GlobalSettings. This way also works for other DI solutions like Guice (as shown here). As far as I know, there currently is no native solution for DI in Play 2.x.
Of course you can also use other features provdided by Spring, like their DAO support or transaction management (however this may require further configuration). We even used Spring Data's MongoDB support.
Just some personal note: I really like the Play Framework for building typical Java MVC webapps, but I found it quite temperamental for building an API only. So if you are also writing your web client using Play, the provided routing and templating are great and give you a head start. For a pure REST service however I ended up using JAX-RS (on Jersey), some basic Spring components and Jetty. We then wrote the web client completely in JavaScript using Backbone, Node and Airbnb's Rendr.
Play has it's own way of managing REST, transactions (depending on the JPA library used) and interceptors.
You can integrate it with Spring, see this demo in github, but I'd first think about if you really need it.
I have a project where I am using the GWT command pattern to implement the RPC. Here how i can integrate the Spring with GWT. Without Spring I am able to achieve the RPC. But here i need to use Spring Dependency Injection for GWT server side packages.
I am unable to find suitable sample or links to implement that.
Can anyone please provide the links and samples which has this requirement.
Without command pattern, I am able to integrate spring with GWT by referring following links
http://technophiliac.wordpress.com/2008/08/24/giving-gwt-a-spring-in-its-step/
https://docs.google.com/document/pub?id=1USHYx9cB3B1s1zM4dlkzEZ759D3lEfavn_dDewvBkaA
Thanks,
Saritha
If you are using gwt-dispatch then you can use the gwt-dispatch-spring-ext to make it work with spring instead of guice. I haven't looked at these for a while - not sure to what extent they are being maintained - please do check before deciding to use these.
Given:
Spring 3.0 mvc has excellent REST support with one of the representation being JSON.
GWT simplifies development as UI is developed in java. But by default it uses RPC for client server interaction. But there is an option to use JSON.
Questions:
Can you share experiences with using Spring 3.0 mvc with GWT ?
What is the best approach to integrate these two frameworks?
Is the default GWT's MVP architecture only for client side and does it work well with JSON?
Thanks
Can you share experiences with using Spring 3.0 mvc with GWT ?
Yes. We've successfully built a whole large application around GWT and Spring MVC (1500 source files, 6 months in development).
Spring was the key to the project's success. Only with Spring we were able to test individually some pieces of the application on the server side.
What is the best approach to marry these two frameworks?
Ignore the default Servlet used by GWT and instead create your own Spring controller to handle incoming GWT-RPC requests. This blog post was the key to integrating the two techs.
We also successfully integrated other components: Flash for animated charts and third-party Javascript components for other stuff. These communicate with the server through JSON. So you have two or more kinds of URLs:
the *.rpc urls are for GWT components and are served by the Spring controller for gwt
the *.json urls are for other components and are served by another Spring controller.
Also, in our case, we shunned configuration with annotations and instead preferred configuration with the good old Spring XML files. They make it much more clear what's going on. Except for the #Required annotation; it's great to find spring beans that should be connected but aren't.
Is the default GWT's MVP architecture only for client side and does it work well with JSON?
GWT's MVP architecture works best if you follow the guide lines. Use GWT-RPC communication as Google suggests.
You can still have JSON for other client-side components.
Try this solution: GWT and Spring MVC Integration
It uses 3 classes. Its very simple, declarative and clear.
It's stupid to mix Spring MVC and GWT. Also it's stupid to mix Spring MVC and JSF... It's stupid to mix 2 MVC (MVP) frameworks together. But you can use Spring DI and GWT for sure!
You may want to check out Spring Roo. It will help you get started quickly with Spring MVC, especially when dealing with RESTful URLs. It also provides a means to automatically set up GWT "scaffolding" (GWT code to interact with the Spring MVC backend). Hope it helps!