问题描述

使用spring boot分模块开发时启动application出现错误

Consider defining a bean of type 'com.nclg.mall.service.AdminService' in your configuration.

原因

spring boot默认只扫描application启动器所在的包及其子包,分模块的包不在同一个包下

解决

指定spring boot应该扫描哪些包

@SpringBootApplication(scanBasePackages = {"com.nclg.mall.api",
        "com.nclg.mall.db","com.nclg.mall.service"})

更多推荐

Consider defining a bean of type ‘com.nclg.mall.service.AdminService‘ in your co