2017年3月25日 星期六

【Spring Boot】Why using spring boot

When I need to produce restful api using spring framework,I use Spring MVC4 ,that I need to config spring structure as below

We saw in project have some config file(xml),in spring xml config file was common usage for spring developer,everything look like well.
But in spring boot ,we don’t need config file anymore,and we don’t need to deploy web app to container.

Lets take a look what the spring boot project structure
Yes,no any config file,and no web.xml,amazing!

When we try to add to tomcat to test out project,ide can not let us add boot app to server

So how can we test out app?
Let's take a look on below file

DomoApplication.java



Lets run it as boot app


We can see this app running on 8080 port
Lets try it on browser,look like it running,but content a bit odd,actually we need to add something
We add some content in DomoApplication.java,and run it again
Looks good now



Spring boot let us drop config files,spring developer all know if our project became big or huge ,we always miss in config files so pain,spring boot let us more config again.

So here we got 2 nice feature
  1. No config anymore
  2. No need to install container before deploy to production server
Great~~~

In next post ,I will write more about why I like to use spring boot for my further java web development.see you~~