Spring ReloadableResourceBundleMessageSource bean unable to find external properties

≡放荡痞女 提交于 2019-12-04 20:00:04

Sooo I somewhat found the problem and got a workaroud..

This didn't work:

<bean id="messageSource"
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename">
        <value>classpath:messages</value>
    </property>
</bean>

And in Code:

@SpringBean
private ReloadableResourceBundleMessageSource messageSource;

By running getClass() on this source I get

class WICKET_org.springframework.context.support.ReloadableResourceBundleMessageSource$$EnhancerByCGLIB$$852b0c02

But this is working:

@Bean
public MessageSource messageSource() {
     ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
     messageSource.setBasename("classpath:messages");
     return messageSource;
}

By running getClass() on this source I get

class org.springframework.context.support.ReloadableResourceBundleMessageSource

Is it possible that Cglib enhancer is messing thigs up here? Any way I can make first option working knowing that?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!