In depth interpretation of Java EE micro framework spring boot

preface

As an important open source framework in the field of Java EE framework, spring framework plays a very important role in enterprise application development. At the same time, there are many spring frameworks and their sub frameworks, so the amount of knowledge is very wide.

Spring boot: a sub framework of spring framework, also known as micro framework, is a framework launched in 2014 to make the development of spring framework easier. After learning the knowledge of spring framework, it is inevitable that the spring framework needs to configure a lot of XML. If you use the spring boot framework, you can use annotation development, which greatly simplifies the development based on the spring framework.

Spring boot makes full use of the configuration mode of javaconfig and the concept of "Convention is better than configuration", which can greatly simplify the development of web applications and rest services based on spring MVC.

Then this blog introduces the creation and deployment of spring boot project based on idea editor.

Spring boot project creation

1. Create Maven project

2. In POM XML is added to the jar of spring boot

If you are only testing a string output, just add spring boot starter (core module) and spring boot starter web (because this is a web project). You can refer to my configuration. Spring boot hot deployment is used here. You need to search for jar on GitHub: springloaded-1.2.4.release.jar, and then download it and put it in the Lib folder of the project

Refresh and download the jar to the Maven project

3. Prepare the program, and the project structure is shown in the figure

Write a startup class application Java:

The startup class sets the port to 8087, because the default port is 8080, and many applications are 8080 ports. To avoid duplication, you'd better change the port yourself

The @ springbootapplication statement allows spring boot to automatically configure the program, which is equivalent to using the default attribute

Write a controller class:

If you don't want to write your own demo, you can import it through http://start.spring.io/ , automatically generate a demo code on the platform, and then open the project

Spring boot deployment

Add a spring boot configuration server

visit:

The above is an in-depth interpretation of the Java EE micro framework spring boot introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>