zoukankan      html  css  js  c++  java
  • OSGi 系列(十八)之 基于注解的 Blueprint

    OSGi 系列(十八)之 基于注解的 Blueprint

    1. 注解实现 blueprint

    第一步:bundle 添加 Bundle-Blueprint-Annotation

    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.0.0</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Bundle-Blueprint-Annotation>true</Bundle-Blueprint-Annotation>
            </instructions>
        </configuration>
    </plugin>
    

    第二步:karaf 要安装以下 4 个 bundle:

    install -s mvn:org.apache.xbean/xbean-bundleutils/3.18
    install -s mvn:org.apache.xbean/xbean-finder/3.18
    install -s mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.api/1.0.1
    install -s mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.impl/1.0.1
    

    注意 karaf 4.1.5 上要重启 aries-blueprint:

    feature:stop aries-blueprint
    feature:start aries-blueprint
    

    或直接在 standard-4.1.5-features.xml 文件中 aries-blueprint 中添加:

    <feature name="aries-blueprint" description="Aries Blueprint" version="4.1.5">
        <feature>aries-proxy</feature>
        <bundle dependency="true" start-level="20">mvn:org.apache.aries/org.apache.aries.util/1.1.3</bundle>
        <!-- Making the compatibility bundle a dependency allows it to only be installed on-demand -->
        <bundle dependency="true" start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0</bundle>
    
        <!-- 添加 Bundle-Blueprint-Annotation 支持 -->
        <bundle start-level="20">mvn:org.apache.xbean/xbean-bundleutils/3.18</bundle>
        <bundle start-level="20">mvn:org.apache.xbean/xbean-finder/3.18</bundle>
        <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.api/1.0.1</bundle>
        <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.impl/1.0.1</bundle>
    
        <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.1</bundle>
        <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.1.0</bundle>
        <bundle start-level="20">mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.8.3</bundle>
        <conditional>
            <condition>bundle</condition>
            <bundle start-level="30">mvn:org.apache.karaf.bundle/org.apache.karaf.bundle.blueprintstate/4.1.5</bundle>
        </conditional>
        <capability>
            osgi.service;effective:=active;objectClass=org.apache.aries.blueprint.services.ParserService,
            osgi.extender; osgi.extender="osgi.blueprint";uses:="org.osgi.service.blueprint.container,org.osgi.service.blueprint.reflect";version:Version="1.0"
        </capability>
    </feature>
    

    2. blueprint 注解使用

    Blueprint Annotations官网

    http://blog.csdn.net/Rongbo_J/article/details/53728846

  • 相关阅读:
    6.66 分钟,一文Python爬虫解疑大全教入门!
    十分钟快速入门 Python,看完即会,不用收藏!
    Python3中真真假假True、False、None等含义详解
    Python基础系列讲解——时间模块详解大全之time模块
    超详细Pycharm部署项目视频教程
    Python进阶量化交易专栏场外篇7- 装饰器计算代码时间
    docker 基本命令
    Linux常用命令
    Docker-部署Mysql
    docker 容器内运行vim命令
  • 原文地址:https://www.cnblogs.com/binarylei/p/8626266.html
Copyright © 2011-2022 走看看