springboot項目:掃描不到其他模塊的包 Parameter 0 of constructor in com.zjxf.repository.UserRepository


報錯信息如下:



***************************

APPLICATION FAILED TO START
***************************


Description:
Parameter 0 of constructor in com.zjxf.repository.UserRepository required a bean of type 'java.lang.String' that could not be found.

Action:
Consider defining a bean of type 'java.lang.String' in your configuration.

疑問:springboot怎么掃描其他模塊的bean

解決:
找不到哪的包就把路徑寫一下就行.這里是com.zjxf.repository.UserRepository這個找不到.
@ComponentScan(basePackages = {"com.zjxf.repository"})

/**
 * 票查保 運營平台啟動類
 *
 * @author WeiQiang
 * @date 2020/9/17 9:31
 */
@EnableSwagger2
@ServletComponentScan
@EnableCaching
@EnableScheduling
@ComponentScan(basePackages = {"com.zjxf.repository"})
@SpringBootApplication(exclude = {RedisRepositoriesAutoConfiguration.class, MongoRepositoriesAutoConfiguration.class})
public class PcbManageApplication {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(PcbManageApplication.class);
        springApplication.addListeners(new ApplicationStartup());
        springApplication.run(args);
    }

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM