我正在尝试在osgi包中使用apache aries进行依赖注入。这个捆绑包有一个servlet,它在捆绑包激活器中注册为服务。如何在blueprint config xml中将servlet配置为bean和/或服务?
发布于 2015-02-13 03:18:32
例如:
<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上找到。
https://stackoverflow.com/questions/28458834
复制相似问题