我创建了一个带有激活器的捆绑包。在启动我的包时,应该调用激活器方法,但它们不是。我已经按照教程中提到的相同方式实现了它。
package com.manning.sdmia;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private BundleContext context;
public void start(BundleContext context) throws Exception {
System.out.println("In bundle");
}
public void stop(BundleContext context) throws Exception {
System.out.println("In stop");
}
}
这是我的MANIFEST.MF
文件:
enter code here
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Spring DM Hello World
Bundle-SymbolicName: com.manning.sdmia.helloworld
Bundle-Version:1.0.0
Bundle-Activator: com.manning.sdmia.Activator
Export-Package:com.manning.sdmia
Import-Package: org.osgi.framework
现在,当我从 OSGI 提示符启动捆绑包时,System.out.println
应该在启动时调用 start 命令,但它没有打印任何内容。