I'm working on a simple Spring Boot application that creates and stores XML files that contain customer licensing information.
But now I would like to add a separate module which imports similar XML files (which were created previously) into the app's database. For that, I need to use the same repository which is used in the app's controller. The repository gets passed into the controller's constructor as follows:
@RestController
@RequestMapping("/api")
class LicenseController {
private LicenseRepository licenseRepository;
private UserRepository userRepository;
public LicenseController(LicenseRepository licenseRepository,
UserRepository userRepository) {
this.licenseRepository = licenseRepository;
this.userRepository = userRepository;
}
Presumably, the controller annotation informs Spring-Boot to pass repositories to the constructor. However, the separate module used for import isn't a controller, it's just a POJO with a main class.
How do I get the license repository into this POJO?