Spring Java Config против Jboss 7

Я пытаюсь запустить на jboss простое приложение с конфигурацией на основе Spring Java, но безуспешно. Это приложение отлично работает как на пристани, так и на коте. Журнал Jboss выглядит хорошо, так как он показывает мне некоторые успешные сопоставления и т. Д., Но я получил 404 попытки получить доступ к URL.

Вот мой код:

Initializer

@Order(1)
public class Initializer extends AbstractAnnotationConfigDispatcherServletInitializer  {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class<?>[] {RootConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class<?>[] {WebAppConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[] {"/"};
    }

    @Override
    protected void customizeRegistration(ServletRegistration.Dynamic registration) {
        registration.setInitParameter("dispatchOptionsRequest", "true");
    }
}

RootConfig

@Configuration
@ComponentScan(value = "com.test.config", excludeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE, value = RootConfig.class))
public class RootConfig {

}

WebAppConfig

@Configuration
@ComponentScan("com.test")
@EnableWebMvc
@EnableSpringDataWebSupport
public class WebAppConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
    }

    @Bean
    public InternalResourceViewResolver setupViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/pages/");
        resolver.setSuffix(".jsp");
        return resolver;
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("index");
    }

    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }
}

А теперь журнал jboss ...

17:08:53,645 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test]] (MSC service thread 1-8) Spring WebApplicationInitializers detected on classpath: [br.com.cleartech.config.Initializer@2f7e4dd2]
17:08:53,767 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test]] (MSC service thread 1-8) Initializing Spring root WebApplicationContext
17:08:53,768 INFO  [org.springframework.web.context.ContextLoader] (MSC service thread 1-8) Root WebApplicationContext: initialization started
17:08:53,770 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-8) Refreshing Root WebApplicationContext: startup date [Wed Dec 18 17:08:53 BRST 2013]; root of context hierarchy
17:08:53,843 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:53,846 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:53,847 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-8) Registering annotated classes: [class br.com.cleartech.config.RootConfig]
17:08:53,915 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:53,916 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:53,977 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:53,978 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:54,130 INFO  [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (MSC service thread 1-8) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
17:08:54,153 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-8) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@52477602: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,rootConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,log4j,webAppConfig,homeController,consoleAppender,fileAppender,registerSpringLogger,org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration,mvcValidator,simpleControllerHandlerAdapter,beanNameHandlerMapping,httpRequestHandlerAdapter,mvcContentNegotiationManager,requestMappingHandlerMapping,resourceHandlerMapping,requestMappingHandlerAdapter,mvcConversionService,viewControllerHandlerMapping,defaultServletHandlerMapping,handlerExceptionResolver,org.springframework.data.web.config.SpringDataWebConfiguration,pageableResolver,sortResolver,setupViewResolver]; root of factory hierarchy
17:08:54,269 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-8) Hibernate Validator 4.2.0.Final
17:08:54,388 INFO  [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/teste],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String br.com.cleartech.controller.HomeController.teste()
17:08:54,404 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Mapped URL path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
17:08:54,631 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
17:08:54,634 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
17:08:54,668 INFO  [org.springframework.web.context.ContextLoader] (MSC service thread 1-8) Root WebApplicationContext: initialization completed in 899 ms
17:08:54,675 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test]] (MSC service thread 1-8) Initializing Spring FrameworkServlet 'dispatcher'
17:08:54,676 INFO  [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-8) FrameworkServlet 'dispatcher': initialization started
17:08:54,679 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-8) Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Wed Dec 18 17:08:54 BRST 2013]; parent: Root WebApplicationContext
17:08:54,681 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:54,682 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:54,683 INFO  [org.springframework.web.context.support.AnnotationConfigWebApplicationContext] (MSC service thread 1-8) Registering annotated classes: [class br.com.cleartech.config.WebAppConfig]
17:08:54,685 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:54,686 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:54,698 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
17:08:54,699 INFO  [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] (MSC service thread 1-8) JSR-330 'javax.inject.Named' annotation found and supported for component scanning
17:08:54,759 INFO  [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (MSC service thread 1-8) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
17:08:54,786 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-8) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12f882f3: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,webAppConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,log4j,rootConfig,homeController,consoleAppender,fileAppender,registerSpringLogger,org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration,mvcValidator,simpleControllerHandlerAdapter,beanNameHandlerMapping,httpRequestHandlerAdapter,mvcContentNegotiationManager,requestMappingHandlerMapping,resourceHandlerMapping,requestMappingHandlerAdapter,mvcConversionService,viewControllerHandlerMapping,defaultServletHandlerMapping,handlerExceptionResolver,org.springframework.data.web.config.SpringDataWebConfiguration,pageableResolver,sortResolver,setupViewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@52477602
17:08:54,885 INFO  [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-8) Mapped "{[/teste],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String br.com.cleartech.controller.HomeController.teste()
17:08:54,891 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Mapped URL path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
17:08:54,927 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
17:08:54,931 INFO  [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-8) Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
17:08:54,962 INFO  [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-8) FrameworkServlet 'dispatcher': initialization completed in 285 ms
17:08:54,977 INFO  [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context: /test
17:08:54,985 INFO  [org.jboss.as] (MSC service thread 1-5) JBAS015951: Admin console listening on http://127.0.0.1:9990
17:08:54,986 INFO  [org.jboss.as] (MSC service thread 1-5) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 8333ms - Started 377 of 455 services (77 services are passive or on-demand)
17:08:55,175 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "test.war"

Как видите, вроде бы все в порядке, так как я получил немного:

Spring WebApplicationInitializers detected on classpath
Initializing Spring root WebApplicationContext
Root WebApplicationContext: initialization started
Mapped URL path [/resources/**]
Mapped URL path [/**]
Registering web context: /test
JBAS018559: Deployed "test.war"

Но при попытке получить доступ к localhost: 8080 / test или даже простому отдыху, объявленному в контроллере, я получил 404.

Заранее спасибо Тьяго

Ответы на вопрос(8)

Ваш ответ на вопрос