【发布时间】:2016-04-24 18:48:15
【问题描述】:
我在我的项目中使用 scr 注释。谁能解释@Component注解中元类型属性的用例?
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
@Component (name = "SampleComponent", label = "TestLabel", description = "This is a test application", ds = true, immediate = false, metatype = true, factory = "com.java.test.sampleComponent")
@Service
【问题讨论】:
-
有几个包提供了
@Component注释。你能指定你使用的是哪个吗?包含 Javaimport语句会有所帮助。 -
@Service 使它看起来像是在使用 Felix SCR 注释。
标签: java osgi apache-felix apache-karaf