2 ms·
Spring is completely undebuggable. If you get your annotations wrong, you simply cannot debug the process. I'm desperately look for tools that can give insight
by sumanthvepa 6y ago
Spring is completely undebuggable. If you get your annotations wrong, you simply cannot debug the process. I'm desperately look for tools that can give insight into what objects were auto wired at runtime.
- ojhughes 6y agoThose tools are part of the Spring Boot actuators. It shows you which beans and auto configuration are active and what conditions activated them
- andor 6y agoIt's trivial to observe runtime behavior with a debugger. If you use constructor injection as it is recommended, just add a breakpoint in the constructor and start the app in the debugger. @Component public class Foo { public Foo(Bar bar) { // breakpoint here } } Edit: In most cases it should be obvious what is getting injected, e.g. in the example Bar is another component/bean that was manually created. If you have two beans of the same type, use a qualifier to specify which one you want. If you are having issues with unexpected things being injected, I'd recommend setting up a few tests that establish that your app is properly wired up.