Consider the following Spring Service class. The spring scope defined is Singleton. The two service beans auto-wired as fields in the class below have similar structure - they t
You can put the @Autowired annotation on top of the services instead of using them in the constructor. It's a Spring managed bean which means it's a singleton. It is thread safe, but that depends on the implementation.
@Service
public class DocumentService {
@Autowired
private DocumentGenerationService documentGenerationService;
@Autowired
private DocumentPublishService documentPublishService;
... methods follow