我们开发了一个需要2个Wicket Web应用程序的应用程序。最初,我们将属性文件放在应用程序所在的同一文件夹中。我们稍后将它们移动到一个bundle文件夹,并将此类用作ResourceLoader:
//Custom resource loader
private static class ReprographyStringResourceLoader implements IStringResourceLoader {
private ResourceLoader messages = new ResourceLoader("ReprographyApplication");
public String loadStringResource(Component component, String key) {
return messages.getString(key, key);
}
public String loadStringResource(Class clazz, String key, Locale locale, String style) {
messages.setContextLocale(locale);
return messages.getString(key, key);
}
我们也在init()中调用它来设置资源加载器类:
// Custom resource loader since our properties are not in the default location
getResourceSettings().addStringResourceLoader(new ReprographyStringResourceLoader());
HTML页面能够正确访问属性文件,但java文件却无法访问。日志表明只加载了wicket的超类属性:
2012-05-11 10:28:43,232 INFO http-8080-2 org.apache.wicket.resource.PropertiesFactory - Loading properties files from jar:file:/D:/opt/tomcat/webapps/reprography-tool/WEB-INF/lib/wicket-1.4.17.jar!/org/apache/wicket/Application_es.properties
2012-05-11 10:28:43,235 INFO http-8080-2 org.apache.wicket.resource.PropertiesFactory - Loading properties files from jar:file:/D:/opt/tomcat/webapps/reprography-tool/WEB-INF/lib/wicket-1.4.17.jar!/org/apache/wicket/Application.properties
这个问题可能是什么原因?