how to inject bean into own implementation SimpleJ

2019-07-15 05:19发布

Follow this tutorial Extending the JPA specification executor i wrote my own implementation of JpaRepository<T, ID>:

public class SimpleFilterableJpaRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements
        FilterExecutor<T> {

    //How to inject object here
    @Autowired
    public JpaFilterSpecificationResolver specificationResolver;

    public SimpleFilterableJpaRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) {
       super(entityInformation, entityManager);

    }

    public SimpleFilterableJpaRepository(Class<T> domainClass, EntityManager em) {
        super(domainClass, em);

    }

..........

}

I have no idea how to deliver JpaFilterSpecificationResolver ? Any idea This class have two constructor. First constructor is called in org.springframework.data.repository.core.support.RepositoryFactorySupport and second is using by JpaRepositoryFactoryBean.JpaRepositoryFactoryBean.

So for second one there is no problem to deliver 'specificationResolver'? but first is called via proxy :/

0条回答
登录 后发表回答