Fix for initialization problems with new spring version

This commit is contained in:
Martin Stockhammer 2017-05-21 22:38:21 +02:00
parent 7e6ad27e07
commit 2cc9dc8b4a
1 changed files with 10 additions and 2 deletions

View File

@ -57,7 +57,7 @@ public class JcrRepositorySessionFactory
@Inject
private Repository repository;
@Inject
// Lazy evaluation to avoid problems with circular dependencies during initialization
private MetadataResolver metadataResolver;
@Inject
@ -75,7 +75,7 @@ public class JcrRepositorySessionFactory
// 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 class JcrRepositorySessionFactory
}
}
// 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