0

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.

masterdany88
  • 5,041
  • 11
  • 58
  • 132

1 Answers1

1

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.

Fabian
  • 403
  • 3
  • 13
  • You posted me to look at Spring Rest Controller, so I assume You don't use Jersey Rest? So how do You work with Entities? Do You have separate classes for client and server? Or do You serialize Entity. With Jersey I see that one class (of entity) can be used to send over the wire (thanks to shared package), but what about Spring Rest Controller? As far I know it can not be done this way. Please help. – masterdany88 Dec 09 '15 at 12:44
  • Yes, you need an Entity class on the server side and a simple POJO on the client side. The Spring RestController (and RestyGWT as well) do serialization with Jackson so they both produce compatible JSON. Sadly I dont have any tutorial for you which covers both. – Fabian Dec 09 '15 at 14:47
  • So how to convert from one to another? Are You doing this manually? Isn't kind a boilerplate? I see that GWTResty can marshal entities automagically (thanks to annotation). Did You consider to use it? Is then jersey mandatory? – masterdany88 Dec 09 '15 at 14:50
  • Everything is done automatically, no boilerplate needed. Example for the RestController from Spring: https://spring.io/guides/gs/rest-service/ – Fabian Dec 09 '15 at 14:53
  • Ok. But how this Entities are able to be used in gwt client? – masterdany88 Dec 09 '15 at 17:42
  • You cant use the entities directly. You have to make another class (POJO) for this entity in GWT (like the class in the shared package). You send the entities to the frontend via HTTP requests and transform them in GWT to your POJO (restygwt is doing this for you) – Fabian Dec 10 '15 at 10:01
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97502/discussion-between-masterdany88-and-feed-me). – masterdany88 Dec 10 '15 at 10:02
  • I did a little demo project. I'm not completely finished with it but it should be sufficient to demonstrate gwt with restygwt https://github.com/feedm3/spring-boot-gwt – Fabian Dec 16 '15 at 07:54
  • Thanks for Your effort. Great example. Thanks one more. – masterdany88 Dec 16 '15 at 12:30