Note that there are some explanatory texts on larger screens.

plurals
  1. POInjected MessageSource is null
    primarykey
    data
    text
    <p><strong>Framework: Spring 3.</strong></p> <p>I really can't understand why the message source injectend in a bean ends up always to be NULL.</p> <p>Here's the snippets:</p> <p>the <code>servlet.xml</code></p> <pre><code>&lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.myproject.controllers" /&gt; &lt;mvc:annotation-driven /&gt; &lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt; &lt;property name="basename" value="/WEB-INF/messages/messages" /&gt; &lt;property name="cacheSeconds" value="0" /&gt; &lt;/bean&gt; </code></pre> <p>the class where the messageSource is injected</p> <pre><code>import com.myproject.controllers.forms.RegistrationForm; @Component public class RegistrationFormValidator implements Validator { @Autowired @Qualifier("messageSource") private MessageSource messageSource; //other stuff here... } </code></pre> <p>here's the controller</p> <pre><code>@Controller @SessionAttributes("userSearchForm") public class UsersController extends PaginationController&lt;ProfiledUser&gt;{ @InitBinder(value="registrationForm") public void initBinder(WebDataBinder binder) { binder.setValidator(new RegistrationFormValidator()); } </code></pre> <p>I have already tried the following:</p> <ol> <li>deleting the annotations and injecting the message source via xml configuration file</li> <li>implementing the MessageSourceAware interface</li> <li>trying to inject a <code>ReloadableresourceBundleMessageSource</code> instead of using interface <code>MessageSource</code></li> </ol> <p>everything ends up in a epic fail ;-) How can I get the MessageSource properly injected?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload