Am trying to develop a integration application with camel using JAVA DSL but when i try to autowire my connection helper i get a null value
Here is the code of :
import com.example.helperproject.ConnectionHelper;
@Singleton
@Startup
@ComponentScan(basePackages = {"com.example.helperproject"})
public class Bootstrap {
@Autowired
private ConnectionHelper connectionHelper;
@PostConstruct
public void init() throws Exception {
try {
System.out.println("Init process begin in singleton bootstrap");
System.out.println(connectionHelper);
}
The connectionHelper prints a null value when we try to autowire with the help of spring when using JAVA DSL. Help me out with any Sample project and how to proceed further ?
Adding ConnectionHelper :
package com.example.helperproject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* ConnectionHelper to establish connection to Database
*
*
*/
@Component
public class ConnectionHelper {
@Autowired
private PropertyHelper propertyHelper;
/**
* Method for getting host
*
* @return host variable for connection
*/
private String getHost() {
String host = propertyHelper.getPropertyByName("host") == null ? "localhost"
: propertyHelper.getPropertyByName("host");
return host;
}
public void insertXMLDocument() {
System.out.println("Test Insert");
System.out.println("------------------>HOST :" + this.getHost());
}
}