I've created a class and I've annotated with @Component, and this class is under the right package where it will do component scan. But still, if I try to Autowire, it's not able to inject. Here is my configuration.
@Component
@ConfigurationProperties(prefix = "request-default-values")
public class DefaultConfig {
//Getters and setters
}
My class where I inject
@Component
public class ProcessRequest {
@Autowired
DefaultConfig defaultConfig;
@Autowired
SalesForceService salesForceService;
public String getUpdateRequest(String req) {
// defaultConfig is coming as null
}
}
The above class is under root package com.bb.app
My spring main application
@SpringBootApplication(scanBasePackages = {"com.bb.app"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Is there anything still I'm missing?