【问题标题】:Apache Aries and Servlet as osgi serviceApache Aries 和 Servlet 作为 osgi 服务
【发布时间】:2015-04-12 02:07:41
【问题描述】:

我正在尝试在 osgi 包中使用 apache aries 进行依赖注入。 这个包有一个 servlet,它在包激活器中注册为服务。 我们如何在蓝图配置 xml 中将 servlet 配置为 bean 和/或服务?

【问题讨论】:

    标签: servlets osgi apache-felix aries


    【解决方案1】:

    例如:

    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
           http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
           http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
           http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0/blueprint-cm-1.0.0.xsd">
    
    <bean id="whiteBoardServlet" class="org.ops4j.pax.web.extender.samples.whiteboard.internal.WhiteboardServlet">
        <argument type="java.lang.String" value="/whiteboard"/>
    </bean>
    <service id="whiteBoardServletService" ref="whiteBoardServlet" interface="javax.servlet.Servlet">
        <service-properties>
            <entry key="alias" value="/whiteboard"/>
        </service-properties>
    </service>
    

    更多详情请访问Pax Web Samples

    【讨论】:

      猜你喜欢
      • 2014-06-07
      • 2014-06-03
      • 2016-12-30
      • 1970-01-01
      • 2011-04-04
      • 1970-01-01
      • 2012-02-28
      • 2012-12-15
      • 1970-01-01
      相关资源
      最近更新 更多