Hi,
I wanted to have an abstract controller that my other controllers extended, just to set up service objects and logging and such. My service objects are autowired fine and logging works, I am having a problem with the MessageSource though.
my message source is defined in my application context like this:
My abstract controller does this:Code:<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>messages</value> </list> </property> </bean>
and my extending controller does this:Code:@Autowired protected MessageSource messageSource; ... public MessageSource getMessageSource() { return messageSource; } public void setMessageSource(MessageSource messageSource) { this.messageSource = messageSource; }
When trying to run it I get a NullPointer exception on the messageSource line in my extending controller.Code:messageSource.getMessage("login.title", null, "My Page Title", null);
I do have a login.title in my messages.properties.
Can anyone see my problem? Cheers.


Reply With Quote