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 8883593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:51:05+00:00 2026-06-14T20:51:05+00:00

Framework: Spring 3. I really can’t understand why the message source injectend in a

  • 0

Framework: Spring 3.

I really can’t understand why the message source injectend in a bean ends up always to be NULL.

Here’s the snippets:

the servlet.xml

<context:annotation-config />

<context:component-scan base-package="com.myproject.controllers" />

<mvc:annotation-driven />


<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="/WEB-INF/messages/messages" />
    <property name="cacheSeconds" value="0" />
</bean>

the class where the messageSource is injected

import com.myproject.controllers.forms.RegistrationForm;

@Component
public class RegistrationFormValidator implements Validator {

@Autowired
@Qualifier("messageSource")
private MessageSource messageSource;


    //other stuff here...

}

here’s the controller

@Controller
@SessionAttributes("userSearchForm")
public class UsersController extends PaginationController<ProfiledUser>{


@InitBinder(value="registrationForm")
public void initBinder(WebDataBinder binder)
{
    binder.setValidator(new RegistrationFormValidator());
}

I have already tried the following:

  1. deleting the annotations and injecting the message source via xml configuration file
  2. implementing the MessageSourceAware interface
  3. trying to inject a ReloadableresourceBundleMessageSource instead of using interface MessageSource

everything ends up in a epic fail 😉
How can I get the MessageSource properly injected?

  • 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-14T20:51:06+00:00Added an answer on June 14, 2026 at 8:51 pm

    I think that you are examining the field values of a CGLIB class

    See spring singleton bean fields are not populated

    update

    A general note about autowiring

    @Autowired annotation is processed by AutowiredAnnotationBeanPostProcessor which can be registered by specifying <context:annotation-config /> annotation in the respective spring configuration file(bean postprocessors work on a per container basis so you need to have different postprocessors for the servlet and for the application root context => you need to put <context:annotation-config /> both to the web app context and the dispatcher servlet configuration ).

    Please note that @Autowired annotation has required property which is set as default to true, that means that if the autowiring process occurs Spring will check that exactly one instance of the specified bean exists. If the bean which fields are annotated with @Autowired is a singleton then, the check will be performed during the application initialization.

    update In this specific question the Validator instance was not created by Spring at all, that is why no autowiring was performed and no initialization exceptions were thrown.

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

Sidebar

Related Questions

I always have used Spring Framework classes as-is. However I am thinking of customizing
Our application is developed using Spring framework. Is it good practice to check null
i AM NEW TO Spring Framework . Can any body explain me difference between
I am new to Spring Framework and trying to understand the functionality of formBackingObject
I have a framework which currently requires pretty verbose setup in Spring: <bean id=dpHibernateRemotingAdapter
I have two Spring proxies set up: <bean id=simpleBean class=org.springframework.aop.framework.ProxyFactoryBean> <property name=target> <ref local=simpleBeanTarget/>
Spring Framework provides many technologies for applications to communicate with each other over HTTP.
I am using Spring Framework . While writing custom queries, I am unable check
I have used spring framework 3 for my application. Everything is ok while developed
I am new to the Spring Framework. With Spring Core course recently taken, what

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.