spring data jpa repository inject fails using @Autowired in spring boot

后端 未结 2 1802
眼角桃花
眼角桃花 2020-12-21 09:29

spring boot entry class

package com.test;

@SpringBootApplication(exclude={
DataSourceAutoConfiguration.class,
DataSourceTransactionManagerA         


        
2条回答
  •  忘掉有多难
    2020-12-21 10:18

    You need to provide the package name to Spring to scan the repositories from, using @EnableJpaRepositories annnotation, e.g.:

    @SpringBootApplication
    @EnableJpaRepositories("com.test.assetmanagementdigital.repository")
    public class AssetManagementDigital2Application
    

    Here's the documentation.

提交回复
热议问题