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
14
pom.xml
14
pom.xml
|
|
@ -30,13 +30,17 @@
|
|||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||
|
|
@ -56,10 +60,14 @@
|
|||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
|
||||
<!-- <artifactId>mybatis-spring-boot-starter-test</artifactId>-->
|
||||
<!-- <version>4.0.1</version>-->
|
||||
|
|
|
|||
|
|
@ -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