This section content:
1: spring boot using a small plug-in
2: Construction of a simple example of the result of style and access
3: After the start of the project and access labeled jar package.
One: Adding boot devtools plug-ins:
After execution, view the pom.xml:
Re-pom, xml file will be more of a dependent.
The role of this tool:
When not in use the plug-in, and then if we want to add a new method in IndexController in, first shut down tomcat server before coding, coding is complete, restart tomcat can access.
Source: Kaige Java (kaigejava). www.kaigejava.com
The benefits of using the plug-in:
In the case of project start can write code directly, it can be accessed directly after saving.
For example: We add a method in IndexController getParam, the return parameters entered by the user.
1: let the project started:
2: In case where the start of the project, perform coding operation:
After encoding is complete, save the log to see control:
Compiler will automatically restart. We do not manually restarted.
GetParam access method in your browser:
Magic ah. We did not even use Chinese garbled ah! !
Why is this? Since spring boot default encoding is UTF-8 encoded.
In pom.xml we can see:
2: The First resul style Code:
Specific code:
Browser preview:
Three: The project labeled jar and start access
3.1: Project Package
the simplest:
Enter the command: clean package
If this is the first time packaged, it will be slower. Because the need to download additional jar. Wait patiently
Etc. appear:
After the build success, description will be successful.
If you need to enter other packaging commands, then:
Use this option maven duild ...
Check the packaging:
Where to find the location of the jar,
In this open a command line:
Enter the command: java -jar + name just packed
We can see that:
Yes, you read right. The project began, it turned up. Really up.
In order to determine whether it is up
We visited in the browser: