标签:ide app hot pre jar span demo jar包 toc
DemoApplication.java:
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@RequestMapping("/")
String index(){
return "这是第一个Spring Boot工程!";
}
}
有3种方式运行
1、直接运行主程序
2、根目录下面mvn spring-boot:run
3、根目录下面mvn install打成jar包
java -jar demo-0.0.1-SNAPSHOT.jar
访问
http://localhost:8080/
标签:ide app hot pre jar span demo jar包 toc
原文地址:https://www.cnblogs.com/yjlch1016/p/10165098.html