List of usage examples for org.springframework.data.jpa.repository.support JpaRepositoryFactoryBean afterPropertiesSet
@Override public void afterPropertiesSet()
From source file:com.google.code.guice.repository.spi.JpaRepositoryProvider.java
@Override public R get() {//from www. jav a2s . c om // double-checked locking with volatile R repo = repository; if (repo == null) { synchronized (this) { repo = repository; if (repo == null) { JpaRepositoryFactoryBean jpaRepositoryFactoryBean = createJpaRepositoryFactoryBean(); PersistenceUnitConfiguration configuration = configurationManager .getConfiguration(persistenceUnitName); // Repository will hold a link to Configuration and if underlying EM will be changed - repo instance will get it EntityManager entityManager = configuration.asEntityManagerProxy(); // Needs to be set first jpaRepositoryFactoryBean.setTransactionManager(configuration.getTransactionManagerName()); // Attaching to Spring's context jpaRepositoryFactoryBean.setBeanFactory(context); jpaRepositoryFactoryBean.setEntityManager(entityManager); jpaRepositoryFactoryBean.setRepositoryInterface(repositoryClass); jpaRepositoryFactoryBean.setNamedQueries(binding.getNamedQueries()); jpaRepositoryFactoryBean.setQueryLookupStrategyKey(binding.getQueryLookupStrategyKey()); if (customImplementationClass != null) { Object customRepositoryImplementation = instantiateCustomRepository(entityManager); if (customRepositoryImplementation != null) { jpaRepositoryFactoryBean.setCustomImplementation(customRepositoryImplementation); } } jpaRepositoryFactoryBean.afterPropertiesSet(); repository = (R) jpaRepositoryFactoryBean.getObject(); repo = repository; } } } return repo; }