server:
port: 8001
mybatis:
config-location: classpath:mybatis/mybatis.cfg.xml
type-aliases-package: com.enxic.enxicapi.entity
mapper-locations:
- classpath:mybatis/mapper/**/*.xml
spring:
application:
name: enxic-dept
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.gjt.mm.mysql.Driver
url: jdbc:mysql://127.0.0.1:3306/ctest
name: root
password: root
dbcp2:
min-idle: 5
initial-size: 5
max-total: 5
max-wait-millis: 200
@Autowired 不能注入dao的原因
1.Mapper.xml中namespace 不对
2.springboot启动类上包扫描路径有问题 @ComponentScan(basePackages = {"com.enxic.enxicdept8001.dao"}) .
Field deptDao in com.enxic.enxicdept8001.service.impl.DeptServiceImpl required a bean of type 'com.enxic.enxicdept8001.dao.DeptDao' that could not be found.
Action:
Consider defining a bean of type 'com.enxic.enxicdept8001.dao.DeptDao' in your configuration.