Fix for initialization problems with new spring version
@Inject
private Repository repository;
- @Inject
+ // Lazy evaluation to avoid problems with circular dependencies during initialization
private MetadataResolver metadataResolver;
@Inject
@@ -75,7 +75,7 @@ public RepositorySession createSession()
// API.
MetadataRepository metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );
- return new RepositorySession( metadataRepository, metadataResolver );
+ return new RepositorySession( metadataRepository, getMetadataResolver() );
}
catch ( RepositoryException e )
{
@@ -84,6 +84,14 @@ public RepositorySession createSession()
}
}
+ // Lazy evaluation to avoid problems with circular dependencies during initialization
+ private MetadataResolver getMetadataResolver() {
+ if (this.metadataResolver==null) {
+ this.metadataResolver = applicationContext.getBean( MetadataResolver.class );
+ }
+ return this.metadataResolver;
+ }
+
@PostConstruct
public void initialize()
throws Exception
