When you are developing a standalone application, that you want to use with the SpringFramework, somewhere in your code you will have to load the application context. Potentially this results in chicken-egg problem, especially when you want to use a component in some class that is not a bean. This may have different causes:
- It is the main class, that is used to start up the application
- The constructor uses arguments that cannot be resolved with autowireing
There are different approaches to solve this, the most elegant one I will demonstrate. „Combining standalone application with Spring“ weiterlesen