How to define common processing for all Repository
Just copy and paste the official document
MyRepositoryImpl.java
class MyRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> {
JavaConfig.java
@Configuration
@EnableJpaRepositories(repositoryBaseClass = MyRepositoryImpl.class)
class ApplicationConfiguration { … }
or
config.xml
<repositories base-package="com.acme.repository" base-class="….MyRepositoryImpl" />
Official documentation https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.customize-base-repository
terasoluna documentation http://terasolunaorg.github.io/guideline/5.3.1.RELEASE/ja/ArchitectureInDetail/DataAccessDetail/DataAccessJpa.html#custommethod-all-label
config.xml
<repositories base-package="com.acme.repository1" base-class="….MyRepository1Impl" />
<repositories base-package="com.acme.repository2" base-class="….MyRepository2Impl" />
https://stackoverflow.com/questions/15008809/multiple-jparepositories-in-xml-config-how-to-configure-with-enablejpareposit
Recommended Posts