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

Problem Description

An error occurs when starting the application when using spring boot sub-module development

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

the reason

By default, spring boot only scans the package where the application launcher is located and its sub-packages, and the sub-module packages are not under the same package

solve

Specify which packages should be scanned by spring boot

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

Guess you like

Origin blog.csdn.net/qq_47768542/article/details/111565218