Parameter 0 of constructor in ‘‘ required a bean of type ‘‘ that could not be found.
当出现 如下 问题时:Parameter 0 of constructor in ''required a bean of type ''that could not be found.问题可能出现的原因,是包扫描不对修改两个地方:启动类,扫描包的注解yml文件mybatis-plus.mapper-locations的值启动类@SpringBootApplication@EnableWiseco
·
当出现 如下 问题时:
Parameter 0 of constructor in ''
required a bean of type ''
that could not be found.
问题可能出现的原因,是包扫描不对
修改两个地方:
- 启动类,扫描包的注解
- yml文件mybatis-plus.mapper-locations的值
启动类
@SpringBootApplication
@EnableWisecoConfigCenter
@ComponentScan(value={"com.wiseco.decision","com.wisecoprod.report","com.wisecoprod.report"})
public class MonitorApplication {
public static void main(String[] args) {
SpringApplication.run(MonitorApplication.class, args);
}
}
修改成
@SpringBootApplication
@EnableWisecoConfigCenter
@ComponentScan(value={"com.wiseco.model","com.wisecoprod.report"})
public class MonitorApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(MonitorApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(MonitorApplication.class, args);
}
}
yml文件
mybatis-plus:
enable: true
global-config:
db-config:
id-type: none
mapper-locations: classpath*:/mybatis/**/*.xml,classpath*:/mapping/**/*.xml
type-aliases-package: com.wiseco.model.**.entity
type-enums-package: com.wiseco.model.service.commons.enums
#jwt:
修改成
mybatis-plus:
enable: true
global-config:
db-config:
id-type: none
mapper-locations: classpath*:/mybatis/**/*.xml,classpath*:/mapping/**/*.xml,classpath*:/mapper/**/*.xml
type-aliases-package: com.wiseco.model.**.entity
type-enums-package: com.wiseco.model.service.commons.enums
更多推荐
所有评论(0)