I was dealing with several spring issues (spring security was usually involved but also other technologies mentioned in tags for this question) with @Configuration
ordering where something was initialized "too early" or "too late".
To name an example: When customizing Tomcat: A ServletContext is required to configure default servlet handling
The answer usually was to create separate @Configuration
file for some of the beans and then it started to work. The nature of the errors (stacktraces) I was getting didn't usually ring bells which was probably my fault :)
Can someone please point me out where I can find information about why creating separate @Configuration
class helps and how the order of @Configuration
classes is determined?
Any tips on what to watch for in the stacktrace to identify this type of issues will be also much appreciated.