in Spr...">

Spring Boot Binding Non-XML JPA Data

What is the Java @Configuration equivalent:

 <repositories base-package="com.acme.repositories" /> 

in Spring JPA Data ? I am trying to get rid of the XML configuration in favor of the @Configuration classes, however reading through the JpaRepositoryConfigDefinitionParser sources is useless.

The closest I can get:

 @Bean public RepositoryFactorySupport repositoryFactory() { return new JpaRepositoryFactory(entityManagerFactory().createEntityManager()) } @Bean public BookDao bookDao() { return repositoryFactory().getRepository(BookDao.class) } 

However, the <repositories/> much more functional: it automatically creates a DAO for all CrudRepository extension CrudRepository found on CLASSPATH. It also seems that my solution does not apply transactions to the DAO, not the default. Spring JPA data behavior.

+8
java spring spring-data spring-data-jpa jpa
source share
2 answers

Spring JPA data introduced by @EnableJpaRepositories . See the Help documentation for more details.

+10
source share

It seems like it is not yet possible: https://jira.springsource.org/browse/DATAJPA-69

+5
source share

All Articles