Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:44:26+00:00 2026-06-09T08:44:26+00:00

I am using spring 3.1.2 MVC. I am trying to configure web application by

  • 0

I am using spring 3.1.2 MVC.
I am trying to configure web application by annotations

Here I want to implement internationalization for that I am using LocaleChangeInterceptor , ReloadableResourceBundleMessageSource ,SessionLocaleResolver classes.
here is my config class :

@Configuration
@EnableWebMvc 
public class MyAppConfig extends WebMvcConfigurerAdapter{

@Bean
public ReloadableResourceBundleMessageSource resourceBundleMessageSource(){
        ReloadableResourceBundleMessageSource messageSource=new ReloadableResourceBundleMessageSource();
        String[] resources= {"classpath:labels","classpath:message"};
        messageSource.setBasenames(resources);
        return messageSource;
    }

@Bean 
public LocaleChangeInterceptor localeChangeInterceptor(){
    LocaleChangeInterceptor localeChangeInterceptor=new LocaleChangeInterceptor();
    localeChangeInterceptor.setParamName("locale");
    return localeChangeInterceptor;
}

@Bean
public SessionLocaleResolver sessionLocaleResolver(){
    SessionLocaleResolver localeResolver=new SessionLocaleResolver();
    localeResolver.setDefaultLocale(new Locale("da","DK"));
    return localeResolver;
}   

public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(localeChangeInterceptor());
}

}

But this is not working it shows default text for

<spring:message code="login.user.password" text="Password" /> 

as “Password”.

please help me.
where as when I do following configuration in applicationContext.xml it works fine.

 <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">


 <property name="basenames">
    <list>
        <value>classpath:message</value>
        <value>classpath:labels</value>            
    </list>
</property>     
<property name="defaultEncoding" value="ISO-8859-1" />
</bean>

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="locale"/>
</mvc:interceptors>


<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    <property name="defaultLocale" value="da_DK" />
</bean>

Please help me to solve this issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:44:28+00:00Added an answer on June 9, 2026 at 8:44 am

    i resolved my problem , i was missing init param entry in my web.xml

    <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextClass</param-name>
            <param-value>
                org.springframework.web.context.support.AnnotationConfigWebApplicationContext
            </param-value>
        </init-param>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                com.config.AppConfig
            </param-value>
        </init-param>
    
        <load-on-startup>1</load-on-startup>
    </servlet>
    

    after adding this entry my config with annotation is working fine. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make this 2-player web game application using Spring MVC. I have
I'm trying to write a web application using Spring MVC. I have a configuration
I'm using Spring's form tag library in a Spring MVC application that I am
I'm creating a web application using spring mvc. I have started to incorporate the
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I'm trying to create a multiaction web controller using Spring annotations. This controller will
I'm trying to do a partial rendering of my web site, using spring mvc
I've implemented a Web application using Spring MVC. The Web application is integrated in
I am prototyping a web application using Spring MVC 3.0 with JasperReports. I have
I'm trying build my application using REST and Spring MVC. For some entities I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.