一:建立maven显目 引入springboot
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.18</version>
</dependency>
</dependencies>
二 写个控制类
@RestController
public class hellocontroller {
@RequestMapping("/hello")
public String hello(){
return "whcnb";
}
三写个springboot运行类
@SpringBootApplication
public class mainApplication {
public static void main(String[] args){
SpringApplication.run(mainApplication.class,args);
}
}
四 启动 访问/hello