1.pom引入springboot
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<!--核心模塊,包括自動配置支持、日誌和YAML -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 測試模塊,包括JUnit、Hamcrest、Mockito -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 引入Web模塊,需添加spring-boot-starter-web模塊: -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
2.
3.新建一個控制層
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello() {
return "Hello Spring Boot!";
}
/**
*獲取車牌列表
* @return
*//*
@RequestMapping("/GetCarMessages")
public String GetCarMessages() {
return "Hello Spring Boot!";
}
*//**
*登錄
* @return
*//*
@RequestMapping("/Login")
public String Login() {
return "Hello Spring Boot!";
}*/
}
4.啓動類
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}