I am new to Apache Camel and trying to build an api. It has three classes.
Class A - this is for reading application.properties file as below
@Configuration
@ConfigurationProperties(prefix="api")
public class A{
private String username;
public String getUsername(){
return username
}
Class B - Apache Camel Route.
Class C - Bean class where class A is autowired.
@Component
public class b extends RouteBuilder{
@Autowired
ClassC customC;
public void configure{
from("direct:start")
.bean(customC)
.to("log:first-timer")
}
}
@Component
class C{
@Autowired
ClassA config;
String username=config.getUsername();
}
Whenever IDE executes the api, it throws Null pointer exception in the line String username=config.getUsername(); .I have verified that spring boot is able to load application.properties.
I am not sure why calling method of autowired class is throwing null pointer exception.