Announcement Announcement Module
Collapse
No announcement yet.
LocaleChangeInterceptor in Java Configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LocaleChangeInterceptor in Java Configuration

    Can anyone tell me how to convert this xml configuration into Java Configuration?

    HTML Code:
    	<mvc:interceptors>
     		<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
     	</mvc:interceptors>
    Last edited by TomBlank; Apr 13th, 2012, 12:13 PM.

  • #2
    Hi Tom,

    What do you exactly mean by java confriguation? It will be great if you can provide some details.

    Thanks
    Rohan Walia

    Comment


    • #3
      Hi!

      Well, I want to get a rid of all my xml configuration and use only Java config. The only thing what is left, is this part so instead of defining LocaleChangeInterceptor inside the application-context.xml I would like to do so in my AppConfig.java.

      It would be great to set the LocaleChangeInterceptor inside my AppConfig.java.

      PHP Code:

      @Configuration
      @EnableWebMvc
      @EnableTransactionManagement
      @EnableScheduling
      @ComponentScan(basePackages "com.company")
      @
      Import(DataConfig.class)
      public class 
      AppConfig extends WebMvcConfigurerAdapter {

          private static 
      Log log LogFactory.getLogAppConfig.class );
          
          @
      Override
              
      public void addResourceHandlersResourceHandlerRegistry registry ) {
              
      registry.addResourceHandler"/resources/**" ).addResourceLocations"/resources/" );
          }
          
          @
      Bean
          
      public TilesViewResolver viewResolver() {
              
      TilesViewResolver resolver = new TilesViewResolver();
              
      resolver.setPrefix"/WEB-INF/jsp/" );
              
      resolver.setSuffix".jsp" );
              return 
      resolver;
          }

              
      // set LocaleChangeInterceptor
             // ....

      Comment

      Working...
      X