Reputation: 10623
I have this code:
@Component
public class CommandStatusInvoker {
@Autowired
@EndpointInject(
uri = "direct:start"
)
private ProducerTemplate commandStatusPublisher;
public CommandStatusInvoker() {
}
I want to move to constructor injection. How do I do that with @EndpointInject?
Upvotes: 2
Views: 880
Reputation: 55555
I dont think its supported, its field or setter/getter injection which is supported: https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java
However if you use spring-boot or something you can let it produce the template and give it some id, and then use spring annotations in the constructor, so you let spring inject the value (eg dont use Camel's @EndpointInject
)
Upvotes: 2