spring-boot启动方式

 
(1)使用@SpringBootApplication(启动main函数即可使用)
@SpringBootApplication
public class HelloworldApplication {
 
 
    public static void main(String[] args) {
        SpringApplication.run(HelloworldApplication.class, args);
    }
 
 
}
 
@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello springboot";
    }
}
 
spring-boot启动方式
(2)使用plugin插件(spring-boot-maven-plugin
spring-boot启动方式
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
spring-boot启动方式
 
双击spring-boot:run
spring-boot启动方式
spring-boot启动方式
spring-boot启动方式
spring-boot启动方式
(3)使用jar命令实现
spring-boot启动方式
双击package
spring-boot启动方式
spring-boot启动方式
输入:java -jar jar包名 即可运行
spring-boot启动方式