Some Notes About Converting Your Java Spring MVC App to SpringBoot
In the last years Spring MVC has quickly lost ground to it's younger brother - SpringBoot.
The major changes are incode annotations instead of XML configurations, as well as embedding an internal application server instead of creating a war which you can throw into an existing external application server (like tomcat). - So it still will use tomcat, it will just be an embedded-internal one.
As I see it those are the main advantages.
So after migrating my own Spring mvc application to be a Springboot one, here are my notes.
The major changes are incode annotations instead of XML configurations, as well as embedding an internal application server instead of creating a war which you can throw into an existing external application server (like tomcat). - So it still will use tomcat, it will just be an embedded-internal one.
As I see it those are the main advantages.
So after migrating my own Spring mvc application to be a Springboot one, here are my notes.
- All I needed was the embedded server - the migration did the job and I am highly satisfied as I don't need to install/maintain another part of the system (the tomcat server), which is very good as now my application has one less complexity.
- Now instead of creating a war file, I create (Maven) a Jar file and run in using java -jar
- The migration was easier than I thought!
- Everything runs faster now - the tomcat is somehow more optimized which is nice
- SpringBoot is a kind of wrapper to Spring mvc, so you don't lose anything from the migration
- Springboot way of thinking is using an opiniated view of things, so it tries to automatically configure anything it finds. - which surprisingly works really well
- The above leads to less code which makes me happier as less is more
- The move from centralized XML configurations to incode annotations is not surely better, I kind of liked the centralized control using the dispatcher-servlet.xml, now in order to find all controllers I need to commence a search for @Controller etc, I am really not sure it is better.
- The way to upgrade the application is going to the dispatcher-servlet and finding how to convert all xml properties to Java annotations
- Go over the WebContent folder and delete all files there (find substitutions to them when needed)
- The POM file should be totally refactored as basically almost all of its entries will be inherited from its parent and using the springboot starter packs, so start by adding the spring boot starter parent then add the the other starter-springboot-artifacts you will need
That's it for now, I will update this post as I find more advantages/disadvantages to springboot
Comments