IDEA Create Springboot Project

Source: Internet
Author: User

First, using idea to generate Springboot project

1) file->new->project, enter Create Project interface

2) Select Springinitializer

3) Click Next to enter the following screen:

4) Click Next to enter the following screen:

Here you can select the relevant jar packages and create them to suit your needs. Of course you can also add them later.

4) Click Next->finish, and you can create a success.

The associated jar packages in Pom.xml are also dependent on the

Ii. Construction of Springboot project

1) in application.properties (here I replaced it with APPLICATION.YML) Configure related properties

2) Create a control layer to test

3) We run the main method in Demotestapplication to start the project

This means that you are already working properly

Iii. Integration of Swagger2

1) Add the corresponding dependency in the Pom.xml

2) Create Swagger2 configuration file Swaggerconfig

3) Add the relevant properties of the SWAGGER2 in the control layer and restart

4) Input http://localhost:2222/swagger-ui.html

5) Normal invocation means the configuration is successful

Iv. Building the SSM framework

1) Add the following dependencies in the Pom.xml

2) Create DAO, Entity, Service (SSM framework is built on the web there are many, here does not repeat the explanation)

Note: @mapper must be added to the DAO class, otherwise springboot will not be able to find the Mapper. If you have a mapper.xml file, put it in resource and indicate the path in the Application.properties file

V. Divide the APPLICATION.YML attribute into multiple yml files

When the properties in the properties file become a lot, you will find that this property file will look messy, so we need to separate the properties file, how to do it?

1) Create application-**.yml in the same directory. As Application-jdbc.yml

2) Add the following attributes to the APPLICATION.YML:

This property will load the property file that starts with application in the same directory, and if there are multiple files, you can continue to add the file after active

Note: When Springboot reads the APPLICATION.YML properties file, it is searched from the following directories: Resources, Resources.config

These are my steps to build a Springboot project, if the great God has better integration recommendations, welcome to the message area to provide valuable advice

IDEA Create Springboot Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.