spring-projects / spring-projects/spring-data-rest
using spring-data-neo4j and spring-data-mongo confuse the spring data rest [DATAREST-1525]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
fssrepository opened DATAREST-1525 and commented
spring boot 2.3.0.RELEASE - I'm not sure about Neumann - (used kotlin also, but i do feel it's unrelated)
- If you have two repositories with the same name but in a different package.
One extends from neo4j, but not from rest (only@Repository- with Neo4jRepository), the other one is mongo, but with@RepositoryRestResource. Accessing the resource by curl, getting back the Neo4jRepository and inserts to the neo4j db. Instead of mongodb.
I just injected the neo4j repository to the mongo eventhandler after create. Renaming one of the Repository and addign@EntityScan("com.raxim.myscoutee.profile.data.document.neo4j") solving this problem. - setting up the following in the config
@EnableMongoRepositories(basePackageClasses = [MongoRepository::class])
@EnableNeo4jRepositories(basePackageClasses = [Neo4jRepository::class])
Causing: (the neo4j alone causing this problem - many similar problem has been raised, but this flavor not)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' availableCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:814) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor.postProcessBeforeInitialization(ConfigurationClassPostProcessor.java:456) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
3. If you won't set @EntityScan("com.raxim.myscoutee.profile.data.document.neo4j") in the config
Neo4j scans @Document/@QueryEntity also, and throwing warnings/info:
2020-05-31 23:19:44.256 INFO 25245 — [ main] o.s.d.neo4j.mapping.Neo4jMappingContext : No class information found in OGM meta-data for class org.springframework.data.geo.GeoModule so treating as simple type for SD Commons
2020-05-31 23:19:44.267 WARN 25245 — [ main] o.s.d.n.mapping.Neo4jPersistentProperty : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.parent
I do feel, that it needs to ignore unrelated annotations in the first place. Repositories has been extended by two different class. (MongoRepository/Neo4jRepository) and the model classes also using different annotations
Affects: 3.3 GA (Neumann)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.