最近遇到一个小问题,是由于不细心造成的。项目配置文件之前是.property,接口也是能调通的,后来改成.yml格式,修改后把mybatis配置在spring下面了,所以一直找不到xml文件报错,网上查了各种方法也不起作用
server: port: 8080 spring: profiles: active: dev redis: host: localhost database: 0 port: 6379 password: pool: max-active: 200 max-wait: -1 max-idle: 10 min-idle: 10 timeout: 1000 # JWT Object save audience audience: clientId: 098f6bcd4621d373cade4e832627b4f6 # A key that can be replaced by Base64 encryption base64Secret: MDk4ZjZiY2Q0NjIxZDM3M2NhZGU0ZTgzMjYyN2I0ZjY= # The issuing subject of the JWT shall be deposited in the issuer name: springbootapi # Expired 24 hours expiresSecond: 86400 pagehelper: helperDialect: mysql reasonable: true # To minimize or maximize the number of pages when the input page is negative or larger supportMethodsArguments: true params: count:countSql mybatis: typeAliasesPackage: com.xj.demo.model mapper-locations: classpath:/mapper/*.xml
正确的方法是把mybatis放在一级目录与spring同级即可
mybatis下的两个元素,缺一不可