简体   繁体   中英

Load properties files in virgo class path

I am migrating my application from standard war to virgo-osgi modularity bundles. Before we used tomcat application server with war deployed. We load all properties file from tomcat lib folder as class path loading. Can i use same way in virgo environment? I found in virgo using different namespace (http://www.springframework.org/schema/osgi-compendium) for load properties file as configuration. I do not want to use that way for now. I prefer same as class path loading. Please help me how to use in virgo.

Thank you, regards, gopy

Considering that in OSGi each bundle has its own classpath, nothing would prevent you from putting your property files in the same bundle (or any other type of resource for the matter, including even non-OSGi-fied JARs ), and reading it like you would usually do in a single-classpath environment.

Having said that, reading your properties through the Compendium Services benefits you with the same modularity benefits that porting your WAR had, as the property file(s) would be considered a separate bundle (of artifact type configuration, in Eclipse Virgo terms) that you can modify in runtime and refresh independently for the changes to take effect according to your design.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM