StudentMapper中代码书写如下
package com.imooc.springbootlearn.mapper;
import com.imooc.springbootlearn.pojo.Student;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Mapper;
@Repository
@Mapper
public interface StudentMapper {
@Select("select from student where id = #{id}")
Student findById(Integer id);
}
有可能是application.properties的datasource属性配置写错了吗?
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/interview?serverTimezone=UTC&\
useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.data-username=root
spring.datasource.data-password=root
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星