SpringBoot启动报错
***************************
APPLICATION FAILED TO START
***************************Description:
Field helloWordService in com.example.demo.controller.HelloWord required a bean of type 'com.example.demo.dao.HelloWordDao' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:Consider defining a bean of type 'com.example.demo.dao.HelloWordDao' in your configuration.
Process finished with exit code 1
1:在Dao层中加上@Mapper注解 之后继承 BaseMapper 类
2:在yml文件引入依赖
#mybatis mybatis-plus: mapper-locations: classpath*:com/zhangtao/moguding/*/dao/mapper/*.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.zhangtao.moguding.*.dto configuration: #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId) map-underscore-to-camel-case: true cache-enabled: false #配置JdbcTypeForNull, oracle数据库必须配置 jdbc-type-for-null: 'null'
3:在启动类加上@MapperScan注解
MapperScan(value = "com.example.demo.dao")*/