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
This commit is contained in:
Olivier Lamy 2011-11-04 08:56:59 +00:00
parent e11c4ccf18
commit 1f57d52fa4
3 changed files with 27 additions and 23 deletions

View File

@ -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( );
}
}

View File

@ -27,6 +27,10 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="false">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
<bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>
@ -52,7 +56,5 @@
<bean name="componentContainer" class="org.codehaus.redback.components.springutils.ComponentContainer"/>
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.webdav.util"/>
</beans>

View File

@ -30,7 +30,8 @@
<context:property-placeholder system-properties-mode="OVERRIDE"/>
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.webdav,org.apache.archiva.metadata.repository"/>
<context:component-scan
base-package="org.apache.archiva.webdav,org.apache.archiva.metadata.repository,org.apache.archiva.webdav.util,org.apache.archiva.common.plexusbridge"/>
<bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
<property name="properties">
@ -46,7 +47,7 @@
<bean name="servletAuthenticator" class="org.apache.archiva.webdav.MockServletAuthenticator"/>
<bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<bean name="archivaConfiguration#default" class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
<property name="registry" ref="registry#default"/>
</bean>