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

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.

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.

Can JSF 1.1 be integrated into Spring Boot? [duplicate]

My team currently has an old JSF 1.1 / Spring2 / Weblogic Monolith Application. As we start towards modernizing our application they want us to take our current architecture, as is, and basically shoe horn it into Spring Boot.
We aren't talking about breaking it down into micro-services at this point, but basically a lift from our current setup, taking Weblogic out of the picture, and running it in Spring Boot with Hikari Data Sources.
Can this be easily done? I haven't found a way to do it without extensive code changes and I don't mind suggesting a "Lets break it down into a micro-services in the next Product Increment" approach.
Outside of re-architecting our application (as we plan in the future) or doing quite a lot of code change, are there any other options?
If you do not use JavaEE for Weblogic, you can migrate your application to the Spring Boot easy enough. The main thing is the correct import of configuration, components, resources and properties. See: example.
If you used in your legacy project JPA or even JDBC to rewrite backend to Spring Data is not very difficult.
From my point of view the main difficulty is the JSF version you are using. I would refuse it, because: 1) it is not fully compatible with Spring boot and 2) it is already out of date today. It takes a lot of effort to put it into the Spring Boot and still it will not work completely. If there is no time and resources to change this view technology to another, you will have to finish it to Spring Boot.
I don't see other real alternatives

Spring Boot vs Spring MVC (In depth)

I've got the basic idea of, what both of them are and when they can be used. I've already referred to this question as well. As of now what I understood was:
Spring Boot bundles a war file with server runtime like Tomcat. This allows easy distribution and deployment of web applications. As the industry is moving towards container based deployments, Spring Boot is useful in this context.
Spring MVC is a traditional web application framework that helps you to build web applications.
What I wanted to know is that, what can be the best practice when it comes to web applications and the differences of using either one of them in depth. Any help would be appreciated.

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

App Servers or Web Server for Spring Framework

first of all: that might be a newbie question. However after few searches I cannot find anything that would bring me further.
Basically what would be the reasons to choose an app server over a Spring framework to develop a medium complex web application? I am fairly new to Spring, did some hard core WebSphere for few years. While reading about Spring I see that it comes with a good bunch of features (transactions, persistence, messaging, connectors etc). Is Spring hard to scale or manage in a clustered environment?
Any comments welcome.
Thanks
Spring is awesome.
Your terminology is way off though. Spring is a Framework. It's a library that you use to write a web application.
An app Server is what your application runs in. You need both. For example, use the Spring Framework to create an app that runs in the Tomcat app server.
EAR files aren't a requirement for doing Java EE development.
It's not either/or: if you deploy a Java EE application you need a container of some kind.
I've deployed Spring apps on Tomcat and WebLogic. I think WebLogic is the best Java EE app server on the market. My decision about whether to deploy to it or not would be based strictly on availability.
You've seen that Spring has their own Java EE container now. It forks Tomcat and marries it with OSGi and Spring. I haven't tried it yet, but if the quality is similar to their framework it will be very promising indeed.
Are you really asking "When would I write an application using Spring? When should I choose EJB3?"
My preference these days is Spring. I can do persistence, transactions, messaging, web services, and everything else I need.
Bpapa,
you got me there, yes the terminology is wrong. I meant Spring + web container vs. App Servers. Surely the web app has to be deployed somewhere. I guess that shifts the question to the server side features as per my first post.
Topology example: Spring + Tomcat vs. WebSphere.
As a side note: people argue if Tomcat is an app server, many consider it rather a web container. You could not deploy an EAR file to Tomcat, can you? All it takes is a WAR, am I right? But that gets too academic.
Thanks a lot
Rod Johnson's "Expert 1:1 Java EE Development Without EJBs" is the basis for Spring. It's an excellent book, but I'd say it's a bit out of date now. The book was written with EJB2 in mind. It was published before Spring became an open source project. The framework is up to version 3.0 now, so I'd say that the book is of historical interest only. I'd recommend a more modern take on the question that takes Spring 3.0 and EJB3 into account.
%

Resources