其他原因不多叙述,我的原因也是非常的低级
记录一下
spring:
redis: #redis连接
host: 127.0.0.1
port: 6379
database: 0
mybatis: # mybatis将代码都托管到了github上,因此我们可以在github上找主配置文件和mapperxml文件的模板内容
config-location: classpath:mybatis_config/mybatis-config.xml # mybatis主配置文件的问题
mapper-locations: classpath:mapper/*.xml # 指定mapperxml 文件位置
上面这个是错误的,原因就是mybatis的配置应该是和spring同级的正确的是顶到头,没有缩进
如何看是不是与Spring同级,可以看mybatisProperties这个类中的前缀标识
@ConfigurationProperties(
prefix = "mybatis"
)
public class MybatisProperties {
public static final String MYBATIS_PREFIX = "mybatis";
如果是spring下级的配置,那么应该是下面这样
@ConfigurationProperties(
prefix = "spring.thymeleaf"
)
public class ThymeleafProperties {