My WicketApplication.properties file has grown very large, and now to keep it more readable I want to categorize properties in different files. Is there a way to accomplish that and still access the properties like if they were all in the WicketApplication.properties?
See org.apache.wicket.settings.IResourceSettings.addStringResourceLoader(IStringResourceLoader). You can implement your own IStringResourceLoader which may load from wherever your want.
You can use property files dedicated per page or even component:
AddressPicker.properties
- properties specific to an AddressPicker.java
componen ProfilePage.properties
- properties used only on a given page ( ProfilePage.java
) WicketApplication.properties
- for aplication-wide properties ( WicketApplication.java
) Wicket, when looking for properties for a given component, will look for the property files in the same order as above. AFAIR Struts2 uses exactly the same technic.
Please look at Wicket documentation: https://cwiki.apache.org/WICKET/i18n-and-resource-bundles.html .
As a last resort, you could write multiple files, but merge them into a single WicketApplication.properties as part of your build process. Unix has a tool precisely for doing this .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.