Hi -
I am creating web app with the ability of cross-store persisting data to SQL and No-SQL database. I am using spring-3.1.2, spring-data-neo4j-2.1.0-RC2 and spring-data-jpa-1.1.0.RELEASE.
Since I am new to neo4j and do not have much experience with Spring, I have started with creating neo4j entities and repositories. I was able to make it working, the data was persisted to graph db - excellent. Bellow is the code of neo4j repositories (looks like the problem may be here):
Code:public interface CustomDenysEntityRepository { @Transactional DenysEntity createDenysEntity(DenysEntity de); }Code:public interface DenysEntityRepository extends CustomDenysEntityRepository, GraphRepository<DenysEntity>, NamedIndexRepository<DenysEntity>{ }My spring-context.xml file is currently not too large:Code:public class DenysEntityRepositoryImpl implements CustomDenysEntityRepository { @Autowired DenysEntityRepository denysEntityRepository; @Override @Transactional public DenysEntity createDenysEntity(DenysEntity de) { DenysEntity result = denysEntityRepository.save(de); return result; } }
As you see I have created the implementation of GraphRepository and NamedIndexRepository with my custom method createDenysEntity. I reused this approach from spring-data-neo4j-reference - everything works fine.Code:<context:spring-configured/> <context:annotation-config/> <context:component-scan base-package="com.serena.cmdb.denys" /> <neo4j:config storeDirectory="target/neo4j-db"/> <neo4j:repositories base-package="com.serena.cmdb.denys.repository"/>
After that I have started to add spring-data-jpa entities and started to get the following error: Exception in thread "main" org.springframework.beans.factory.BeanCurrentlyInC reationException: Error creating bean with name 'denysEntityRepositoryImpl': Bean with name 'denysEntityRepositoryImpl' has been injected into other beans [denysEntityRepository] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
Not sure why do I have this error now? I didn't have it before and was not making changes to neo4j repositories. I was also thinking about some versioning issue, but this is not the case (I believe) because I have created two projects: one of them just with neo4j logic and another one with both neo4j and spring-data-jpa logic (I created the second project just to figure out the reason of the issue that I have). These two projects have identical classpaths, so I think that some new jar files are not the reason of the issue that I have. I see now only one difference: spring-context.xml. Now it looks as follows:
Not sure what is the problem and do not know how to fix it, three days spent with no result... Please help!Code:<context:spring-configured /> <context:annotation-config /> <context:component-scan base-package="com.serena.resourcemgmt" /> <jpa:repositories base-package="com.serena.resourcemgmt.repositories" /> <neo4j:config storeDirectory="resourcemgmt-neo4j-db-test" entityManagerFactory="entityManagerFactory"/> <neo4j:repositories base-package="com.serena.resourcemgmt.repositories"/> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:config.properties" /> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="persistenceUnitName" value="spring-jpa" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="${hibernate.show_sql}" /> <property name="generateDdl" value="${hibernate.generate_ddl}" /> </bean> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${db.driver}" /> <property name="url" value="${db.url}" /> <property name="username" value="${db.username}" /> <property name="password" value="${db.password}" /> </bean>
Thanks in advance,
-Denys.


Reply With Quote