Osgi将bean注入激活器
我有3个类,一个是Activator,另外两个是'mysqlConfiguration'和'BinaryLogListner',其中'mysqlConfiguration'使用blueprint注入'BinaryLogListner' 这是我的蓝图(注射部分): 当我尝试使用注入“BinaryLogListner”的“mysqlConfiguration”时,我将得到一个空指针异常 我想知道如何将bean注入激活器,这可能吗?Osgi将bean注入激活器,osgi,blueprint-osgi,Osgi,Blueprint Osgi,我有3个类,一个是Activator,另外两个是'mysqlConfiguration'和'BinaryLogListner',其中'mysqlConfiguration'使用blueprint注入'BinaryLogListner' 这是我的蓝图(注射部分): 当我尝试使用注入“BinaryLogListner”的“mysqlConfiguration”时,我将得到一个空指针异常 我想知道如何将bean注入激活器,这可能吗? 有没有想过如何在这些情况下启动bean?在Activator中,使用
有没有想过如何在这些情况下启动bean?在Activator中,使用新的BinaryLogListner()实例化类。因此,您只需获得无需任何蓝图注入的普通类。这些注入仅在blueprint创建bean实例时有效 您只需在任何blueprint bean上使用init方法来对捆绑包的(blueprint)激活作出反应,而不是使用激活器
通常,在捆绑包中使用blueprint时,不应同时使用激活器。在激活器中,使用新的BinaryLogListner()实例化类。因此,您只需获得无需任何蓝图注入的普通类。这些注入仅在blueprint创建bean实例时有效 您只需在任何blueprint bean上使用init方法来对捆绑包的(blueprint)激活作出反应,而不是使用激活器 通常,在捆绑包中使用blueprint时,不应同时使用Activator
<bean id="binaryLogListnerBean" class="cdc.mysql.BinaryLogListner">
<property name="mysqlConfiguration" ref="configManagementMysql"></property>
</bean>
BinaryLogListner binaryLogListner = new BinaryLogListner();