【发布时间】:2019-08-31 15:50:41
【问题描述】:
OSGI 新手。
我在 OSGI 中使用 spring-boot。在 bundle activator 中,spring-boot 应用程序启动成功。我有一个组件类如下
@Service // spring-boot annotation
@Component(immediate = true) // osgi annotation
public class Test {
@Activate
public void activate() {
System.out.println("osgi component activated");
}
@Reference
public void set(ServiceComponentXXX a) {
System.out.println("reference got");
}
Test 类只绑定服务,不被任何其他服务绑定。 ServiceComponnetXXX 类来自其他捆绑包。 activate 和 set 方法永远不会执行。
删除spring-boot注解@Service后,代码运行正常。那么问题来了,一个类可以同时是 spring-boot 组件和 OSGI 组件吗?
【问题讨论】:
标签: spring-boot osgi