I'm trying to inject messageSource bean to one my component classes.
Here is part of bean xml:
<context:annotation-config />
<context:component-scan base-package="com.mattis.test"/>
<bean id="localeResolver"
      class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    <property name="defaultLocale" value="en" />
</bean>
<bean id="messageSource"
      class="org.springframework.context.support.ResourceBundleMessageSource">
      <property name="basename" value="messages" />
</bean>
And in my component I've got this:
@Component
public class TestClass {
@Autowired
private MessageSource messageSource;
<-- more code goes here -->
}
Always when I instantiate TestClass, messageSource is null. I tried more bean xml and class configurations but none of them worked.
 
    