In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use IDEA to create SpringBoot maven project, the article is very detailed, has a certain reference value, interested friends must read it!
New project
Select the maven project and JDK, and click next:
Select the project path, enter the project name, and click finish:
Configure the pom.xml file
The new project requires the introduction of springboot dependencies, and version 2.4.4 is selected here.
The complete pom file is as follows:
4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.4 org.example SpringBoot-Test 1.0-SNAPSHOT UTF-8 UTF-8 1.8 org.springframework.boot spring-boot-starter-web org.springframework .boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin configure application.yml
You need to configure the port number (default is 80) and the project name in the configuration file. Of course, you can start normally without configuration, but it is better to finish the configuration in order to distinguish it from other projects.
# Service port number. Default 80server: port: 8866spring:# service name application: name: springboot-test create startup file
Create a com/springboot directory under the src/main/java directory, create a startup file under the springboot directory, name it SpringBootTestApplication, add the main entry, configure the @ SpringBootApplication annotation, and declare that this is a SpringBoot project:
Start the project
Right-click to start the project file and select run:
After a successful startup, the console displays the port number of the startup as the port number set by us.
Test interface access
Create a controller directory under the com/springboot directory to store control layer files, create TestController classes, add @ RestController annotations, declare that this is the control layer, define the test interface method demo, and print the access successfully:
Restart the project and use Terminal to access http://localhost:8866/test/demo for testing
Successful visit
The above is all the content of the article "how to use IDEA to create a maven project for SpringBoot". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.