I have created an AccountPanel class that is using another class UserClientApi to call some microservices to process information about customers.
@Component
public class AccountPanel {
private static final int notificationTime = 5000;
@Autowired
private UserClientApi api;
...
}
@Component
public class UserClientApi {
@Value("${user.api.url}")
String apiUrl;
@Autowired
RestTemplate rest;
@Override
public Reader findUserByName(String name) {
...
}
...
}
First I had problems with autowiring RestTemplate, until I added a bean that creates it. Now I am having problems with injecting UserClientApi. I tried 2 dozens of suggestions but still my api variable is always null. I tried extracting interface, added component scan, etc. Nothing is working. Can someone help me? I am using spring-boot 2.7.4 with JDK 14