2.Select project type
3.Select project
4. Write the project group and name -finish
##5. Modify the pom.xml file
<!-- spring boot基本环境 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.2.RELEASE</version> </parent>
6.Add dependencies in pom.xml
<!--web应用基本环境配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
7.Add compilation plug-in in pom.xml
<build> <plugins> <!-- spring-boot-maven-plugin插件就是打包spring boot应用的 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins </build>
8. Basic packages and classes
9. Create resources folder and application.properties file
10.App.java
package com.springboot.springbootDemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class App { public static void main( String[] args ) { SpringApplication.run(App.class, args); } }
11.HelloController.java
package com.springboot.springbootDemo.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("hello2") public class HelloController { @RequestMapping("") public String hello() { return "helloworld2"; } }
12. Start the project
13. Access the project (lower versions may not be accessible, version 2 is available)
http://localhost:8012/hello2Method 3
Click Generate Project to download the project compressed package
After decompressing, use eclipse, Import -> Existing Maven Projects -> Next ->Select the decompressed folder- > Finsh, OK done!The above is the detailed content of What are the ways to create springboot projects in eclipse. For more information, please follow other related articles on the PHP Chinese website!