Using Node.js along with old Java Web application (Spring MVC)

I have an existing web application. It uses Spring MVC on Tomcat and MySQL at the back end with transactions (multi table updates). I am also using spring security for role based authorization. This is very typical website without any real time notification, chat etc.

Now my client wants to add real time notifications like Facebook, chat module etc. Typically on front end some action will be taken, and all or specific logged in users need to get notified. After receiving notification, I need to update some <div> content. Frequency would be high. (Currently user needs to refresh browser.)

I completed POCs using Node.js/Express and looks like it's easy to accomplish these 2 things with Node.js.

I have 3 options:

  • Move front end to Node.js and may be Angular.js. Manage form validations / security through Node.js/Angular.js but all database calls are still managed by my old website (in a RESTful manner) as I can reuse my existing stuff. Most of the method calls return to a tile but we can easily convert to return JSON object.
  • Keep existing website as it is and plug in Node.js into it just for real time notification / chat etc.
  • Scrap existing website and redo everything including security, transactions using Node.js. There are many posts saying as Node.js is kind of new, not preferable for enterprise application and also this might be too much.
  • Approach 2 would be my preferred approach as we have expertise in Spring, Node would be completely new for us but I don't know whether it's practical & doable approach, what kind of issues I might be facing. I am also not sure how to integrate Spring MVC running on Tomcat and Node.js together.

    Please could anybody help me in deciding, out of the three what's the best way to go? Any other approach which might be easier?


    You already have an existing Spring MVC codebase and you can reuse it. However you can go ahead with AngularJS for your front-end technology. Your front-end AngularJS code can talk to your existing Spring MVC via REST api and to NodeJS for real-time features which you plan to develop. You need to use Socket.io within NodeJS which will provide the features you are looking for.

    One major problem you might face is related to session when talking to two different backend stack.

    链接地址: http://www.djcxy.com/p/67110.html

    上一篇: 在cPanel中把node.js代码放在哪里

    下一篇: 使用Node.js和旧的Java Web应用程序(Spring MVC)