[
https://issues.apache.org/jira/browse/CAMEL-8125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14312313#comment-14312313
]
Daniel Pocock commented on CAMEL-8125:
--------------------------------------
Just another observation on this for Camel 2.13 users and a workaround:
- if I instantiate the PropertiesComponent as a spring bean like this:
<bean id="properties"
class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="file:${project.home}/properties"/>
</bean>
then I have the NullPointerException problem and can't inject properties into
my RouteBuilder.
If I instantiate the PropertiesComponent this way:
<camelContext id="camel" ... >
<propertyPlaceholder id="properties"
location="file:${project.home}/properties"/>
....
then I can use the PropertyInject annotation without the NullPointerException.
I tried manually instantiating the RouteBuilder as a Spring bean and then
putting a reference to it in my <camelContext/> but that didn't help resolve
the issue. I'm currently using the <package>org.example.project</package>
element without <camelContext/> to automatically find and instantiate my
RouteBuilder and as long as I set <propertyPlaceholder/> it seems OK.
> PropertyInject gives NullPointerException
> -----------------------------------------
>
> Key: CAMEL-8125
> URL: https://issues.apache.org/jira/browse/CAMEL-8125
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.14.0
> Environment: Linux, JDK1.7, standalone Camel/Spring J2SE process
> running in Eclipse
> Reporter: Daniel Pocock
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.14.1, 2.15.0
>
>
> Using the annotation @PropertyInject on a field of the RouteBuilder class
> gives a NullPointerException
> public class RouteBuilder extends SpringRouteBuilder {
>
> @PropertyInject("foo.bar")
> private String fooBar;
> ...
> }
> Using the {{ }} notation in endpoint URIs is working though.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)