Integrate New Spring MVC framework for coming module and struts 1 and hibernate 2 based existing framework in single web application web.xml - spring

Currently I am working on struts 1,spring 2 and hibernate 2 based web application.now we are going to add some more module in our application but the requirement is that we have to integrate new module with spring MVC framework without doing any changes for existing module.
So how can i integrate new spring MVC framework and existing framework in single application together ?
What changes i have to do in web.xml file ?
So is it possible to use (hibernate 2 and hibernate 4) jars and (spring 2 and spring 4) jars in single application ?
If it is possible then what about hibernate session factory , how this is going to be handled ?

Its quite bad idea I think. Especially packing different versions into one jar may cause several compile and runtime problems. You shouldn't do it.
Two different MVC frameworks for one web application is probably not impossible but also very bad decision.
If you cannot drop existing code/project, you should start with clean new seperate project and try to configure them to run side by side on production. But no mix up.

Related

I am developing a website I know bootstrap and learned spring I want to know what else can be done to make it better?

I want to know what spring dependencies should I use on my website to make the work easy and spring or spring boot which one is better. also, suggest some frontend technologies that I can use to make the website smart.
It's a very broad question. And it all depends on what features you want in your web site. Just listing few basic module to give you some hints.
Spring MVC - For web application with MVC Pattern
Spring Security - To secure your app
Spring ORM - If using any ORM tool like hibernate
You need to explore more on the basis of your need.
Spring Boot vs Spring:
You should use Spring Boot if you are starting new project. Spring Boot came to make development process easier when using Spring Framework. In Spring, developer had to write lots of code to configure beans and dependencies. Spring Boot automated this process so that you no longer do it by yourself but Spring Boot will take care of it. Plus it provides some extra tools (In built Web Server, in Memory DB, tool to monitor and manage Spring Boot App )
Try to create a simple web app in Spring and Spring Boot to understand the difference.
Front-end Technologies:
JavaScript based framework/lib like Angular,React,Vue etc. are the trend for front-end now a days. Again there are pros and cons of each of them. Hence you need to evaluate, what suits you better as per your requirement.

How to apply the Strangler Pattern with old Struts 1 application into Spring app

We currently have an old web application that's been developped under Struts 1.4.3 Framework. This application works fine on a production environment,
but now we need to upgrade it to Spring. Instead of starting a new app as a greenfield project, we figured out that it could be a better idea for our client if we'd apply some transition techniques, such as the Strangler pattern. Then, we could bring some business value quickly to the client during the development process.
So here is our plan:
We will develop new screens one by one (Spring boot web app), and release those screens in production environment once they're ready.
I would like my main entry point to be into our new Spring boot application.
Then, I'd like to commute the requests of the client to whether new developed screen under spring boot controllers, or to old existing Struts 1 actions.
So for the user, the transition from a old to a new application would be 100% transparent
I found some solutions on Internet but none of them seems to give a clear way to proceed.
This article seems really appropriate to my need: https://www.ibm.com/developerworks/library/j-sr2/index.html
But I'm having questions that the article does not answer.
Do Struts and Spring code base have to be within the same Java project in order to use the article's recipes?
The article stated above is 14 years old, so Spring libraries handling the integration of Struts appear to be deprecated. I can't find "org.springframework.web.struts" anymore in Spring framework 4.3.20. How to apply it now?
Thanks guys for your help.

Convert project from Spring framework to Spring boot

I have a set of projects in Spring framework and I have to Find the ones which can be converted to Spring boot.
Is there anything that is related to Spring framework and cannot be converted to spring boot ? In my research, I Could not Find something like that.
But does anyone know something, like a dependency, which would force the project to stay in Spring framework ?
Spring Boot uses the Spring Framework as a foundation and improvises on it. It simplifies Spring dependencies and runs applications straight from a command line. Spring Boot provides several features to help manage enterprise applications easily. Spring Boot is not a replacement for the Spring, but it’s a tool for working faster and easier on Spring applications. It simplifies much of the architecture by adding a layer that helps automate configuration and deployment while making it easier to add new features.
Most of the changes for migrating Spring Framework application to Spring Boot are related to configurations.This migration will have minimal impact on the application code or other custom components.Spring Boot brings a number of advantages to the development.
It simplifies Spring dependencies by taking the opinionated view.
Spring Boot provides a preconfigured set of technologies/framework to reduces error-prone configuration so we as a developer focused on building our business logic and not thinking of project setup.
You really don’t need those big XML configurations for your project.
Embed Tomcat, Jetty or Undertow directly.
Provide opinionated Maven POM to simplify your configurations.
Application metrics and health check using actuator module.
Externalization of the configuration files.
Good to refer this for migrating from Spring to Spring Boot application: https://www.javadevjournal.com/spring-boot/migrating-from-spring-to-spring-boot/

Mixing spring 3 and 4

I have a legacy application that uses Spring 3.x. It's built using Maven and creates a war file. It's big, perhaps what would be called a monolith nowadays.
I'm slowly moving to a micro services architecture and as a first stage I'd like to create Maven sub-projects built as JAR files (within the web application) that contain Spring controllers that use the newer #RestController annotations of Spring 4.
Will there likely be problems do you think of mixing version 3 and 4 of Spring? I'd like to scan the package structure of the jar file from the existing Spring 3 app in order to detect the Spring 4 annotations.
Thanks in advance.

Can a simple JSp and servlet code be migrated to Spring framework?

I am a newbie in web development. I'm using servlets and JSP for web development.However, I've learnt lately that Spring Framework is apt for that which incorporate servlets, jsp etc. So, my question is that can I now run my program using Spring framework ? Like, I have 2 jsp codes, and 1 servlet class. So, how can I migrate the code in Spring Framework ? what additional things or codes do I need to maintain ?
Migrating an existing J2EE project is easy.
You will get rid of a lot of "boilerplate" code in the process. The easiest way to do it in my opinion will be to use SpringToolSuite.
Import your project in STS and then add "Maven" nature to it. In the pom configuration you can edit all the jars that you need and mention the spring framework. Once all this is setup it will be just a matter of minutes to change the code if it is small.
You can follow these video tutorials about maven and spring to learn about it.
JavaBrains
There are more tutorials by "New Circle training" on youtube for the same.
I would also recommend you to read Spring in action 3rd edition-Manning
This book is a must and the best way to learn spring framework. Hope this helps

Resources