I have a bean used in MyApp, but when I have MyApp app = new MyApp(), then carIF is null. What is the best practice to solve this issue? I have tried to make MyApp as a bean as well by adding @Component, so I don't need to do 'new MyApp()', but it turns out I need to keep making a java class as bean in my java classes calling workflow, which I don't think it is a right approach. How to solve the issue like this?
public class MyApp() {
@Autowired
private CarIF carIF;