1 Replies Last post: Jul 1, 2013 3:32 PM by Sergey.Vasiliev  
Austin Vance Newbie 2 posts since
Jun 30, 2013
Currently Being Moderated

Jun 30, 2013 2:14 AM

"No view resolvers found" with annotation based config

I am using @Configuration classes instead of the traditional dispatcher-servlet.xml to configure a SpringMVC 3.2 application. In my @Configuration class I configure a view resolver like so

 

@Configuration

@EnableWebMvc

@ComponentScan("com.austinbv.usethisroom")

public class DispatcherModule {

  @Bean

  public InternalResourceViewResolver internalResourceViewResolver() {

    InternalResourceViewResolver resolver = new InternalResourceViewResolver();

    resolver.setPrefix("/WEB-INF/pages/");

    resolver.setSuffix(".jsp");

    return resolver;

  }

}

 

 

and then I register the @Configuration class with my WebApplicationInitializer

 

@SuppressWarnings("unused")

public class WebAppInitializer implements WebApplicationInitializer {

  @Override

  public void onStartup(ServletContext container) {

    AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();

    dispatcherContext.register(DispatcherModule.class);


    ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));

    dispatcher.setLoadOnStartup(1);

    dispatcher.addMapping("/");

  }

}

 

Even though a view resolver is registered I still get the warning. Is there a way to either suppress the warning like I have done with the unused waring on my WebAppInitializer, or can I set Intellj to understand the view resolver.

 

Thank you

Austin

More Like This

  • Retrieving data ...