From 1f57d52fa4b1be922f490e8e8a20d1558a2de190 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 4 Nov 2011 08:56:59 +0000 Subject: [PATCH] fix component in charge of cleaning maven index @Inject comes from a lot of packages: just use the good one :-) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197434 13f79535-47bb-0310-9956-ffa450edef68 --- .../webdav/util/MavenIndexerCleaner.java | 39 ++++++++++--------- .../resources/repository-servlet-simple.xml | 6 ++- .../spring-context-servlet-security-test.xml | 5 ++- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java index 8c960e38f..a2bf649ca 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java @@ -18,7 +18,6 @@ package org.apache.archiva.webdav.util; * under the License. */ -import com.opensymphony.xwork2.inject.Inject; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; @@ -31,6 +30,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; +import javax.inject.Inject; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; @@ -44,7 +44,25 @@ public class MavenIndexerCleaner Logger log = LoggerFactory.getLogger( getClass() ); - PlexusSisuBridge plexusSisuBridge; + private PlexusSisuBridge plexusSisuBridge; + + @Inject + private ApplicationContext applicationContext; + + @PostConstruct + public void startup() throws Exception + { + plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); + cleanupIndex( ); + } + + @PreDestroy + public void shutdown() + throws Exception + { + cleanupIndex( ); + } + public void contextInitialized( ServletContextEvent servletContextEvent ) { @@ -88,22 +106,5 @@ public class MavenIndexerCleaner } } - @Inject - private ApplicationContext applicationContext; - - @PostConstruct - public void startup() throws Exception - { - plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); - cleanupIndex( ); - } - - @PreDestroy - public void shutdown() - throws Exception - { - cleanupIndex( ); - } - } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml index 033af17d9..4f95eaecb 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/repository-servlet-simple.xml @@ -27,6 +27,10 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="false"> + + + + @@ -52,7 +56,5 @@ - - \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml index b4c7d1d41..62a91b38e 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/spring-context-servlet-security-test.xml @@ -30,7 +30,8 @@ - + @@ -46,7 +47,7 @@ - + -- 2.39.5