3

It sometimes seems to be that the answer of Spring to the explosion of rich web clients is: @ResponseBody. However, the ability to just supply json imho is no longer enough. As the client becomes ever richer, templates have to live on the frontend as well. There is handlebars and dust to help you deal with this although Spring doesn't document any of this. But just having the raw technology is not the same as having a smooth development path.

What we struggle with is the question how to have things like

  • Use the same templates on the client, that may be mobile, as on the server
  • Server side rendering
  • Smooth integration with React.js

All of this with Spring in stead of Node.js where everything on this front seems to be a piece of cake. There seems to be precious little information on these challenges and if you have a significant template base, the idea of duplication on the frontend and backend becomes problematic.

Any suggestions how to deal with this?

Marc
  • 6,773
  • 10
  • 44
  • 68
  • possible duplicate of [Which spring view resolver plays nice with angularjs?](http://stackoverflow.com/questions/24838165/which-spring-view-resolver-plays-nice-with-angularjs) – Paul Sweatte Oct 09 '14 at 01:04
  • @Marc All I can add is that I agree with your question 100%. It is starting to seem the answer is that Spring only wants to serve json and leave everything else to another technology. i.e. NodeJs. There have been some enhancements with caching etc.. – code Apr 18 '15 at 20:15

1 Answers1

0

The Spring Framework team is working on this for 4.2 - isomorphic apps with client+server templates using JDK8 Nashorn - see SPR-12266.

You'll find more information about that in that presentation and this sample project (Spring + react.js + JDK8 Nashorn).

Note: if you're tired of adding @ResponseBody annotations all over the place, take a look at @RestController annotations (available since 4.0).

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176