简体   繁体   English

在virgo类路径中加载属性文件

[英]Load properties files in virgo class path

I am migrating my application from standard war to virgo-osgi modularity bundles. 我正在将我的应用程序从标准战争迁移到virgo-osgi模块化软件包。 Before we used tomcat application server with war deployed. 在我们使用tomcat应用服务器部署战争之前。 We load all properties file from tomcat lib folder as class path loading. 我们从tomcat lib文件夹中加载所有属性文件,作为类路径加载。 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. 我在处女座中发现使用不同的名称空间(http://www.springframework.org/schema/osgi-compendium)作为负载属性文件的配置。 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. 考虑到在OSGi中每个捆绑包都有其自己的类路径,没有什么可以阻止您将属性文件放入同一捆绑包(或与此相关的任何其他类型的资源, 甚至包括非OSGi-fied JAR ),并像您一样读取它通常会在单类路径环境中执行。

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. 话虽如此,通过Compendium Services读取属性将为您带来与移植WAR相同的模块化优势,因为属性文件将被视为独立的捆绑包(在Eclipse Virgo术语中为工件类型配置)。可以在运行时进行修改并独立刷新,以使更改根据您的设计生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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