Spring and rich clients (React.js, etc.), preventing duplicate templates

At times, it seems like Spring's answer to the explosion of rich web clients is @ResponseBody. However, being able to just supply json imho is no longer enough. As the customer gets richer, templates should live on in the front-end. There are rudders and dust to help you deal with this, although Spring does not document this. But just having the original technology is not the same as having a smooth development path.

What we are struggling with, the question is how to have things like

  • Use the same templates on the client that can be mobile as on the server
  • Server side submission
  • Seamless integration with React.js

It's all with Spring instead of Node.js, where everything on this front seems like a piece of cake. There seems to be very little information about these issues, and if you have a sizable template base, the idea of ​​duplication on the frontend and backend becomes problematic.

Any suggestions how to handle this?


source to share

1 answer

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

More details on this can be found in this presentation and this sample project (Spring + react.js + JDK8 Nashorn).

Note. If you're tired of adding annotations @ResponseBody

all over the place, take a look at annotations @RestController

(available since 4.0).



All Articles