@@ -0,0 +1,2600 @@
+package pl.openrest.filters.repository;%0A%0Aimport static org.springframework.data.querydsl.QueryDslUtils.QUERY_DSL_PRESENT;%0A%0Aimport java.io.Serializable;%0A%0Aimport javax.persistence.EntityManager;%0A%0Aimport org.springframework.data.jpa.repository.JpaRepository;%0Aimport org.springframework.data.jpa.repository.support.JpaEntityInformation;%0Aimport org.springframework.data.jpa.repository.support.JpaRepositoryFactory;%0Aimport org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;%0Aimport org.springframework.data.jpa.repository.support.SimpleJpaRepository;%0Aimport org.springframework.data.querydsl.QueryDslPredicateExecutor;%0Aimport org.springframework.data.repository.core.RepositoryMetadata;%0Aimport org.springframework.data.repository.core.support.RepositoryFactorySupport;%0A%0Apublic class PredicateContextAwareJpaFactoryBean%3CR extends JpaRepository%3CT, I%3E, T, I extends Serializable%3E extends%0A        JpaRepositoryFactoryBean%3CR, T, I%3E %7B%0A    protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) %7B%0A%0A        return new PredicateContextAwareJpaFactory(entityManager);%0A    %7D%0A%0A    private static class PredicateContextAwareJpaFactory%3CT, I extends Serializable%3E extends JpaRepositoryFactory %7B%0A%0A        public PredicateContextAwareJpaFactory(EntityManager entityManager) %7B%0A            super(entityManager);%0A        %7D%0A%0A        @SuppressWarnings(%7B %22unchecked%22, %22rawtypes%22 %7D)%0A        protected %3CT, ID extends Serializable%3E SimpleJpaRepository%3C?, ?%3E getTargetRepository(RepositoryMetadata metadata,%0A                EntityManager entityManager) %7B%0A            Class%3C?%3E repositoryInterface = metadata.getRepositoryInterface();%0A            JpaEntityInformation%3C?, Serializable%3E entityInformation = getEntityInformation(metadata.getDomainType());%0A%0A            SimpleJpaRepository%3C?, ?%3E repo = isQueryDslExecutor(repositoryInterface) ? new PredicateContextQueryDslRepositoryImpl(%0A                    entityInformation, entityManager) : new SimpleJpaRepository(entityInformation, entityManager);%0A%0A            return repo;%0A        %7D%0A%0A        @Override%0A        protected Class%3C?%3E getRepositoryBaseClass(RepositoryMetadata metadata) %7B%0A%0A            if (isQueryDslExecutor(metadata.getRepositoryInterface())) %7B%0A                return PredicateContextQueryDslRepositoryImpl.class;%0A            %7D else %7B%0A                return SimpleJpaRepository.class;%0A            %7D%0A        %7D%0A%0A        private boolean isQueryDslExecutor(Class%3C?%3E repositoryInterface) %7B%0A%0A            return QUERY_DSL_PRESENT && QueryDslPredicateExecutor.class.isAssignableFrom(repositoryInterface);%0A        %7D%0A    %7D%0A%7D%0A

Add PredicateContextAwareJpaFactoryBean that creates PredicateContextQueryDslRepositories