I see the following alternatives and do not know which one is better than the other.
a) Keep @ComponentImport
annotation on your classes where you require ActiveObjects like this:
@ComponentImport
private ActiveObjects activeObjects;
And in combination with this add the following to the Spring configuration:
<bean class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
<constructor-arg ref="activeObjects"/>
</bean>
This solution is based on the ActiveObjects component being available under the name activeObjects or else this will not work.
b) Remove all @ComponentImport annotations from your code and require Spring to resolve ActiveObjects with OSGi so that there is only one instance available to your classes.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner/2"
xmlns:osgi="http://www.eclipse.org/gemini/blueprint/schema/blueprint"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.atlassian.com/schema/atlassian-scanner/2
http://www.atlassian.com/schema/atlassian-scanner/2/atlassian-scanner.xsd
http://www.eclipse.org/gemini/blueprint/schema/blueprint
http://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd">
<osgi:reference id="activeObjects">
<osgi:interfaces>
<value>com.atlassian.activeobjects.external.ActiveObjects</value>
</osgi:interfaces>
</osgi:reference>
<bean id="tx-processor" class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
<constructor-arg ref="activeObjects"/>
</bean>
<atlassian-scanner:scan-indexes/>
</beans>
Can anybody tell me which of those two alternative is the better way or whether there is another solution to favor over those two?