mysql
mysql-connector-java
runtime
在看application.properties中配置mysql,和mybatis中的mapper路径,和实体路径(resources文件夹就可)
#数据库设置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/ywttest
spring.datasource.username=root
spring.datasource.password=root
#mybatis_config
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.rosam.ywttest.entity
controller层的代码(com.rosam.ywttest.controller)
package com.rosam.ywttest.controller;
import com.rosam.ywttest.entity.User;
import com.rosam.ywttest.service.YwtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframewor