update 8.20
This commit is contained in:
7
pom.xml
7
pom.xml
@ -72,6 +72,13 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- knife4j -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package com.example.practice.controller;
|
|
||||||
|
|
||||||
import com.example.practice.entity.User;
|
|
||||||
import com.example.practice.mapper.UserMapper;
|
|
||||||
import com.example.practice.mapper.UserMapperImpl;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
//@Controller // UserController userController = new UserController(); userController对象放到SpringIOC容器中
|
|
||||||
//@ResponseBody // 把返回值打印到浏览器上
|
|
||||||
|
|
||||||
@RestController // @Controller + @ResponseBody
|
|
||||||
@RequestMapping("/user")
|
|
||||||
public class UserController {
|
|
||||||
|
|
||||||
private UserMapper userMapper = new UserMapperImpl();
|
|
||||||
|
|
||||||
@GetMapping("/selectAll")
|
|
||||||
public List<User> queryAll() {
|
|
||||||
List<User> users = userMapper.selectAll();
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,9 +1,11 @@
|
|||||||
package com.example.practice.mapper;
|
package com.example.practice.mapper;
|
||||||
|
|
||||||
import com.example.practice.entity.User;
|
import com.example.practice.entity.User;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper // 将UserMapper的接口实现类对象生成,放入SpringIOC容器 UserMapperImpl userMapperImpl = new UserMapperImpl()
|
||||||
public interface UserMapper {
|
public interface UserMapper {
|
||||||
|
|
||||||
List<User> selectAll();
|
List<User> selectAll();
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
spring:
|
|
||||||
datasource:
|
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
url: jdbc:mysql://localhost:3306/practice
|
|
||||||
username: root
|
|
||||||
password: 123456
|
|
@ -1,28 +1,28 @@
|
|||||||
<!--<?xml version="1.0" encoding="UTF-8" ?>-->
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!--<!DOCTYPE configuration-->
|
<!DOCTYPE configuration
|
||||||
<!-- PUBLIC "-//mybatis.org//DTD Config 3.0//EN"-->
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
<!-- "http://mybatis.org/dtd/mybatis-3-config.dtd">-->
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
|
||||||
<!--<configuration>-->
|
<configuration>
|
||||||
|
|
||||||
<!-- <environments default="dev">-->
|
<environments default="dev">
|
||||||
|
|
||||||
<!-- <environment id="dev">-->
|
<environment id="dev">
|
||||||
<!-- <transactionManager type="JDBC"/>-->
|
<transactionManager type="JDBC"/>
|
||||||
<!-- <dataSource type="POOLED">-->
|
<dataSource type="POOLED">
|
||||||
<!-- <property name="driver" value="com.mysql.cj.jdbc.Driver"/>-->
|
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
|
||||||
<!-- <property name="url" value="jdbc:mysql://localhost:3306/practice"/>-->
|
<property name="url" value="jdbc:mysql://localhost:3306/practice"/>
|
||||||
<!-- <property name="username" value="root"/>-->
|
<property name="username" value="root"/>
|
||||||
<!-- <property name="password" value="123456"/>-->
|
<property name="password" value="123456"/>
|
||||||
<!-- </dataSource>-->
|
</dataSource>
|
||||||
<!-- </environment>-->
|
</environment>
|
||||||
|
|
||||||
<!-- </environments>-->
|
</environments>
|
||||||
|
|
||||||
<!-- <mappers>-->
|
<mappers>
|
||||||
<!-- <mapper resource="mapper/UserMapper.xml"/>-->
|
<mapper resource="mapper/UserMapper.xml"/>
|
||||||
<!-- </mappers>-->
|
</mappers>
|
||||||
|
|
||||||
<!--</configuration>-->
|
</configuration>
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user