|
|
Re: Does Gemini Blueprint support JSR 250 annotations? [message #1808352 is a reply to message #1808287] |
Fri, 21 June 2019 19:59 |
Jim Ziesig Messages: 3 Registered: June 2019 |
Junior Member |
|
|
Hi Florian,
Thank you for the reply. We have a good amount of Spring-DM XML, so I was trying to maintain our original Spring-DM file format while migrating, however, I have tried using a blueprint file similar to yours for this test, and it is still not working. The classes used to verify that annotations are functional are very simple and don't include any product code. Perhaps
the platform is coming into play? I am using Karaf 4.2.5 on Java 9 and Spring 5.0.12_RELEASE_1.
The two classes used to verify functionality are:
PostConstructUser -
package test.postconstruct;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class PostConstructUser
{
private Integer i = null;
@PostConstruct
public void init()
{
System.out.println( "PostConstructUser initializing: " + this );
i = new Integer(1);
}
public Integer getI()
{
return i;
}
}
PostConstructTester -
package test.postconstruct;
import javax.inject.Inject;
public class PostConstructTester
{
private PostConstructUser user;
public void init()
{
if (user.getI() == null)
{
System.out.println("PostConstruct check failed. Karaf is not properly handling annotated classes.");
}
}
@Inject
public void setUser( PostConstructUser user )
{
this.user = user;
}
}
And the 'XML':
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
default-activation="eager">
<!--
Enables annotation configurations (e.g. @PreDestroy,
@PostConstruct, @Autowired)
-->
<context:component-scan base-package="test.postconstruct"/>
<context:property-placeholder />
<!--<bean id="user" class="test.test.postconstruct.PostConstructUser"/>-->
<bean id="tester" class="test.postconstruct.PostConstructTester"
init-method="init">
</bean>
</blueprint>
I install using features and these are the features 'XML' file:
<?xml version="1.0" encoding="UTF-8"?>
<features name="my-features">
<feature name="libs" version="1.0.0">
<bundle start-level="32">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_3</bundle>
</feature>
<feature name="gemini-blueprint" description="Eclipse Gemini Blueprint support" version="3.0.0.M01">
<feature version="1.0.0">libs</feature>
<feature version="5.0.12.RELEASE_1">spring</feature>
<bundle start-level="30">mvn:org.eclipse.gemini.blueprint/gemini-blueprint-core/3.0.0.M01</bundle>
<bundle start-level="30">mvn:org.eclipse.gemini.blueprint/gemini-blueprint-io/3.0.0.M01</bundle>
<bundle start-level="30">mvn:org.eclipse.gemini.blueprint/gemini-blueprint-extensions/3.0.0.M01</bundle>
<bundle start-level="30">mvn:org.eclipse.gemini.blueprint/gemini-blueprint-extender/3.0.0.M01</bundle>
<!-- Shouldn't need this, but Gemini Blueprint doesn't include Provide-Capability header for osgi.extender=osgi.blueprint
so the deployer feature doesn't install this bundle -->
<!--<bundle start-level="24">mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.blueprint/4.2.5</bundle>-->
</feature>
<feature name="my-test-postconstruct" version="1.0.0">
<feature version="3.0.0.M01">gemini-blueprint</feature>
<bundle start-level="50">mvn:testing/postconstruct/3.8.0-SNAPSHOT</bundle>
</feature>
</features>
Regardless of whether I install with our product code or the simpler version, I always see the message shown below that is emitted from the tester class:
karaf@root(feature)> install libs
karaf@root(feature)> install gemini-blueprint
karaf@root(feature)> install my-test-postconstruct
karaf@root(feature)> PostConstruct check failed. Karaf is not properly handling annotated classes.
Thanks again,
Jim
[Updated on: Fri, 21 June 2019 20:17] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04174 seconds