6

I am trying to integrate spring-mvc and reactjs, but it's too poor example, but I like flux architect of reactjs so that i strongly want to integrate reactjs with springmvc! I want to use reactjs as a client side, springmvc as a rest backend. Can you provide me some example or tutorial to do this? I've searched on google but it's very poor result. Please help me. Thanks you very much

1 Answer 1

7

This answer might not be what you want, but I would advise you not to integrate the two of them. If they communicate over HTTP/WebSockets, they are already decoupled, and it might just cause you pain to couple them.

Advantages of decoupling the frontend and backend into separate projects:

  • People with experience only in React or Spring can contribute without getting confused by the other stuff.
  • The tooling/build you need for a Spring project is quite different from what you need for a frontend project, and mixing this into one code base can get pretty confusing.
  • If they're decoupled from the start, it gets easier to add other clients that use the backend API. By having them as separate projects, you're less likely to develop the backend in a way that's very tied to the frontend.
  • The frontend and the backend should use different versions and be shippable independently of each other. What if the backend team is currently doing a major refactoring, but the frontend team just fixed a critical bug and wants to ship a new release?
  • As soon as you add asset caching to your frontend project (like putting the files on a CDN, using the HTML5 application cache or the new Service Worker API), you have to prepared for getting requests to your backend from "old" clients. By separating them, it's easier to think about and plan for stuff like that on the backend.

I could probably list a couple of more benefits, but these are the ones I consider has the largest impact. There are of course some benefits of integrating the two of them, but those tend to get smaller and smaller as the project grows/matures.

2
  • Thanks you for your answer, Actually I've integrate success springmvc with angularjs. AngularJS like as a client side, springmvc like as a REST backend (like jersey webservice like this: github.com/philipsorst/angular-rest-springsecurity). But I like Reactjs because it's have new architecture (Flux architecture), so that I wanna try on it. Thanks Apr 17, 2015 at 8:31
  • 1
    If you already knows how to expose the endpoints with Spring MVC you can change the AngularJS for ReactJS, you already not coupling them, like @Anders said, maybe a misunderstand of what @Anders said ? Apr 21, 2015 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.