Spring Boot – Java Development Made Easy

If you are planning for a Java web application, first thing you will decide is to use Spring framework. This framework is best known for its Inversion Of Controller container and along with it’s extensive support on MVC, JDBC, JMS, Aspect and many more fronts which you may need while developing a web application. Few years back the Pivotal introduced world to Spring Boot. This has changed the way Java development and deployment is done.

Prior to Spring Boot, even though you are using Spring Framework you have to go through xml based configuration to make sure your application starts up fine. After that you would need to setup an application server to deploy your artifact and test if its working as expected. Spring Boot comes with auto configurations for all types of project and it comes with embedded tomcat server. Due to this you can run and test your application right from your Eclipse IDE.

spring-boot

Here we will see how simple is it to develop Java Web MVC application using Spring Boot and Maven.

Create a Maven project and add below dependency to your POM file to get power of spring boot to your project.

Above dependency spring-boot-starter-web will add all required libraries for a web mvc application to your project’s classpath, you don’t have to look for any other dependency. After that add below class to your project.

The annotation SpringBootApplication will configure your project to be an web application. You can see we have also added annotation Controller to define one method for mapping to home url of application. This method will return plain text “Hello World!” in browser.

By default boot comes with embedded tomcat that runs on port 8080. Just right click on above file in your IDE and run as Java. You will see in console Spring Boot starting up and a message that your application is started. Once you get this message simply go to browser and type http://locahost:8080.

That’s it you application is up and running in less that 10 seconds. Isn’t it great to see your web application running so fast. Spring Boot has definitely changed the way development is happening and it has reduced the development efforts considerably.

Spring has also provided an online utility to create a project template as per your need. Spring Starter, using this you can add features to your project and download the skeleton which you can use and add more functionalities as per your needs.

We at Opencodez will try to explore Spring Boot and post many tutorials, codes for our readers that we are sure going to help in some way or the other. You can refer many more such articles like below

 

Add a Comment

Your email address will not be published. Required fields are marked *