嵌入式环境配置—VMware 软件安装和虚拟机的创建

mybatis

3.5.2

org.springframework

spring-webmvc

5.2.0.RELEASE

org.springframework

spring-jdbc

5.1.9.RELEASE

org.aspectj

aspectjweaver

1.8.13

org.mybatis

mybatis-spring

2.0.2

org.projectlombok

lombok

1.16.10

src/main/java

**/*.properties

**/*.xml

true

[](()代码演示

[](()第一步 User类

package com.kuang.pojo;

import lombok.Data;

@Data

public class User {

private int id;

private String name;

private String pwd;

}

[](()第二步 UserMapper接口

package com.kuang.mapper;

import com.kuang.pojo.User;

import java.util.List;

public interface UserMapper {

public List selectUser();

}

[](()第三步 UserMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>

select * from mybatis.user;

[](()第四步 核心配置文件

db.properties

driver=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/mybatis?useSSL=false&characterEncoding=utf8

username=root

password=root

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8" ?>

spring-dao.xml(固定的)

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns=“http://www.springframework.org/schema/beans”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xmlns:aop=“http://www.springframework.org/schema/aop”

xsi:schemaLocation="http://www.springframework.org/schema/beans

https://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/aop

https://www.springframework.org/schema/aop/spring-aop.xsd">

猜你喜欢

转载自blog.csdn.net/zywcxz/article/details/129232307