diff options
author | Martin Stockhammer <martin_s@apache.org> | 2017-05-21 22:38:21 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2017-05-21 22:38:21 +0200 |
commit | 2cc9dc8b4af78e78d46aab4b0472c2a710d5c740 (patch) | |
tree | be091c92e258ca551c0f60098189f946bc31c88f /archiva-modules | |
parent | 7e6ad27e07f58b3ce8875c53da89ee4e63cb8ecd (diff) | |
download | archiva-2cc9dc8b4af78e78d46aab4b0472c2a710d5c740.tar.gz archiva-2cc9dc8b4af78e78d46aab4b0472c2a710d5c740.zip |
Fix for initialization problems with new spring version
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java index 8589ecbdd..1c51dfc73 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java @@ -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 |