学习课程来源:https://time.geekbang.org/course/detail/156-80189
步骤1:
步骤二:填写group ,以及选择依赖
步骤三:idea 打开 项目
步骤四:编写SpringBootApplication 入口文件
package com.lv.spring.hello.springdemo;
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 SpringDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDemoApplication.class, args);
}
@RequestMapping("hello")
public Stringhello(){
return "hello Spring";
}
}
访问 url curl http://localhost:8080/hello
其它监控功能:curl http://localhost:8080/actuator/helath
查看所有bean : http://localhost:8080/actuator/beans
imagemaven 打包方式
打包 跳过测试
mvn clean package -Dmaven.test.skip
执行
cd target
dir 显示所有包咯 / ls
imagejava -jar spring-demo-0.0.1-SNAPSHOT.jar
网友评论