New to Springboot I know this has been asked so many times....
I have the following controller which has a CustomRestTemplate autowired. CustomRestTemplate has another bean autowired called RestClientConfig .
RestClientConfig is always null? I annotated with @Component but it never gets initialized inside CustomRestTemplate
@RestController
@RequestMapping("/catalog")
public class CatalogController {
@Autowired
private CustomRestTemplate restTemplate;
.
.
CustomRestTemplate has RestClientConfig autowired
RestClientConfig injected inside CustomRestTemplate is always null, why is that?
@Component
public class CustomRestTemplate{
@Autowired
private RestClientConfig restClientConfig // always null;
public CustomRestTemplate()
{
}
}
@Component
public class RestClientConfig {
private String val;
public RestClientConfig()
{
this.val = "test";
}
}