I am in a service, with a scheduled task, and I want to get an object from the database. It has EAGER associations, so the find method should get it totally.
@Service
public class CustomTask {
@Autowired
CustomRepository customRepository;
@Scheduled(fixedRate = 1000)
public void action() {
customRepository.find(1);
}
}
But here it doesn't work. The associations are null
.
While inside a Spring Boot Controller, the repository method works perfectly.
Do you know I can get my whole object in this Scheduled method of a Service?