feat(controller): 添加Demo控制器并更新依赖配置
- 创建了DemoController类,提供/hello接口返回"Hello World!" - 在pom.xml中添加spring-boot-starter核心依赖 - 将spring-boot-starter-webmvc替换为spring-boot-starter-web - 将spring-boot-starter-webmvc-test替换为spring-boot-starter-test - 添加spring-boot-starter-actuator监控组件 - 注释掉数据库相关依赖以简化项目配置
This commit is contained in:
parent
15c1e6a11f
commit
f4dbb3a80e
12
pom.xml
12
pom.xml
|
|
@ -30,13 +30,17 @@
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
|
<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||||
|
|
@ -56,9 +60,13 @@
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||||
<!-- <artifactId>mybatis-spring-boot-starter-test</artifactId>-->
|
<!-- <artifactId>mybatis-spring-boot-starter-test</artifactId>-->
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.example.demo.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController()
|
||||||
|
@RequestMapping("/demo")
|
||||||
|
public class DemoController {
|
||||||
|
|
||||||
|
@RequestMapping("/hello")
|
||||||
|
public String demo() {
|
||||||
|
return "Hello World!";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue