package cn.palmte.work.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import top.jfunc.common.db.utils.Pagination; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * @author xiongshiyan at 2018/7/23 , contact me with email yanshixiong@126.com or phone 15208384257 */ @Configuration public class PaginationConfig { @PersistenceContext @Autowired private EntityManager entityManagerPrimary; ///错误的注入方式 /*@Primary @Bean(Constant.PRIMARY_PAGINATION) public Pagination primary(@Qualifier(Constant.ENTITY_MANAGER_PRIMARY_DB) EntityManager entityManager){ return new Pagination(entityManager); }*/ @Primary @Bean public Pagination primaryPagination(){ return new Pagination(entityManagerPrimary); } }