Closed smtrad closed 2 years ago
You have to use the annotation "@EnableJpaRepositories" in your main class: @SpringBootApplication @EnableJpaRepositories(repositoryFactoryBeanClass = EntityGraphJpaRepositoryFactoryBean.class) public class Application { ...
Hope that helps.
Bug report template bypassed => issue closed.
If you prefer using a Configuration-File thats the way to go.
@EnableJpaRepositories(repositoryFactoryBeanClass = EntityGraphJpaRepositoryFactoryBean.class,basePackageClasses = ProjectMainClass.class)
or if you rather want to specify the basePackage:
@EnableJpaRepositories(repositoryFactoryBeanClass = EntityGraphJpaRepositoryFactoryBean.class,basePackages = "project.base.package")
@reda-alaoui you should update the doucmentation according to that information, to provide a smooth start for new users.
With spring-boot-starter-parent= 2.5.4 , java version 11 and spring-data-jpa-entity-graph.version 2.5.0 (or <) a Bean Repository could not be found on application start.
APPLICATION FAILED TO START
Description:
Field userRepository in com.ead.authuser.service.impl.UserServiceImpl required a bean of type 'com.ead.authuser.repository.UserRepository' that could not be found.
@Configuration @EnableJpaRepositories(repositoryFactoryBeanClass = EntityGraphJpaRepositoryFactoryBean.class) public class JpaRepositoryConfig { }
`@Repository public interface UserRepository extends GenericRepository<User, UUID> {
}`
public interface GenericRepository<MODEL extends AbstractEntity, MODEL_ID extends Serializable> extends //JpaRepository<MODEL, MODEL_ID>, JpaSpecificationExecutor<MODEL> EntityGraphJpaRepository<MODEL, MODEL_ID>, EntityGraphJpaSpecificationExecutor<MODEL> { }
Note that when I use "extends JpaRepository<MODEL, MODEL_ID>, JpaSpecificationExecutor" the application works fine.