Spring-OSGI 1.0 M3中文手册 - 编程入门网
Spring-OSGI 1.0 M3中文手册时间:2011-11-02 DIY部落关于headers的细节参见OSGi规范中的3.2节。一些OSGi实现框架可能会支持一些与众不同的jar包,但 是这些jar包关于OSGi的格式还是不变的。 The Spring extender recognizes a bundle as "Spring-powered" and will create an associated application context when the bundle is started if one or both of the following conditions is true: 如果满足以下两个条件,Spring extender会通过一个bundle的具有"Spring-powered"的验证,当这个 bundle启动时会为其创建一个相关联的application context: The bundle classpath contains a folder META-INF/spring with one or more files in that folder with a ''.xml'' extension. 这个bundle的classpath包含一个目录META-INF/spring,这个目录中有一个或多个扩展名为''.xml''的 文件。 META-INF/MANIFEST.MF contains a manifest header Spring-Context. 这个bundle中的META-INF/MANIFEST.MF文件包含一个名为Spring-Context的header。 In addition, if the optional SpringExtender-Version header is declared in the bundle manifest, then the extender will only recognize bundles where the specified version constraints are satisfied by the version of the extender bundle (Bundle-Version). The value of the SpringExtender-Version header must follow the syntax for a version range as specified in section 3.2.5 of the OSGi Service Platform Core Specification. 另外,如果bundle的manifest声明了可选header - SpringExtender-Version,那么extender将仅仅认 可与之版本相符的指定版本约束的bundle(bundle的Bundle-Version)。SpringExtender-Version的值必 须遵循OSGi规范3.2.5节中指定的版本范围。 In the absence of the Spring-Context header the extender expects every ".xml" file in the META-INF/spring folder to be a valid Spring configuration file, and all directives (see below) take on their default values. 在缺少Spring-Context的情况下,spring extender仍然认为所有META-INF/spring中".xml"的文件都 是spring的配置文件,所有的header都是默认值。 An application context is constructed from this set of files. A suggested practice is to split the application context configuration into at least two files, named by convention modulename-context.xml and modulename-osgi-context.xml. The modulename-context.xml file contains regular bean definitions independent of any knowledge of OSGi. The modulename-osgi -context.xml file contains the bean definitions for importing and exporting OSGi services. It may (but is not required to) use the Spring Dynamic Modules OSGi schema as the top-level namespace instead of the Spring ''beans'' namespace. application context就是根据这些文件(META-INF/spring中".xml"的文件)构造的。一个推荐的做法 是将application context配置文件至少分割成2个文件,习惯上命名为 [模块名-context.xml] 和[模块 名-osgi-context.xml]。modulename-context.xml文件包含了不依赖与OSGi相关的bean的定义(可以理解 为普通bean定义)。modulename-osgi-context.xml文件则定义那些引入或输出OSGi服务的bean。这可能 需要使用Spring Dynamic Modules的OSGi schema做为顶级命名空间,取代spring的''bean''命名空间,但 这不是必须的。 Spr |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |