All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.fantasticmao.mundo.data.partition.PartitionJpaRepositoryFactoryBean Maven / Gradle / Ivy

There is a newer version: 1.0.10
Show newest version
package cn.fantasticmao.mundo.data.partition;

import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;

import javax.annotation.Nonnull;
import javax.persistence.EntityManager;

/**
 * PartitionJpaRepositoryFactoryBean
 *
 * @author fantasticmao
 * @version 1.0
 * @since 2019/1/2
 */
public class PartitionJpaRepositoryFactoryBean extends JpaRepositoryFactoryBean {

    public PartitionJpaRepositoryFactoryBean(Class repositoryInterface) {
        super(repositoryInterface);
    }

    @Override
    @Nonnull
    protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) {
        RepositoryFactorySupport repositoryFactorySupport = super.createRepositoryFactory(entityManager);

        PartitionDataSourcePostProcessor partitionDataSourcePostProcessor = new PartitionDataSourcePostProcessor();
        repositoryFactorySupport.addRepositoryProxyPostProcessor(partitionDataSourcePostProcessor);
        return repositoryFactorySupport;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy