Build tutorial (a) of the web-based Spring boot project

Preface:

This large number of predecessors tutorial reference code, this is not convenient enumerated. This tutorial uses IDEA development tools to build the project, for I have integrated some of the IDEA plug-ins, such as Lombok, Thymeleaf, yml and other plug-ins that are not provided in the text, because the plug only facilitate a better development, rather than the project must be.

Began to build the project from a blank, I also belong to the novice, there is something wrong welcomed the comments below or contact me.

Build a project using IDEA

First, the new spring boot project

Select the file → new → project in the menu, here I have opened other projects, if the page is to start your own operation

Up a dialog box to select the illustrated press, project SDK select their own system installed JDK

Fill out the relevant content to press the next button

Select spring boot assembly, here I only choose web, subsequent re-add. There spring boot version of the above, I am using a spring boot 2.1.5

Select the project name and save path

Also wait a minute after you've created the project, waiting for the idea to download jar package, the initial project structure as shown below

Second, start a simple project

First, delete application.properties use application.yml

application.yml defaults to utf-8 encoding, and the encoding application.properties but not uniform, my idea of ​​this document is GBK encoding, yml more concise than properties, is recommended to avoid stepping pit, delete properties (not renamed)

After deleting the file properties directly in the resource directory Right-new → file, enter application.yml be determined, no additional operation, spring boot will automatically determine the use of yml

Second, start the project

The idea toolbar click Run, or click debug,

If you can not find here the startup configuration, it can be directly on XXXApplication right-class run (since spring boot option is to build a jar, so to start the project with the main function)

 

如果你看到控制台有如下输出,恭喜你,项目启动成功

 

 这就完了?对,spring boot就这样启动成功了。

相比之前的spring等框架,spring boot具有快速配置的功能

Guess you like

Origin www.cnblogs.com/q1143910315/p/spring_boot_web_project.html