You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring uses the class name and converts the first letter to lowercase by default. In vscode, @dependsOn("BEAN_NAME") won't able to find the bean and not able to navigate to DependsOn bean class.
To Reproduce
Create 2 Compoments.
@Component
public class TestBean1 {}
@Component
@DependsOn("testBean1")
public class TestBean2 {}
Notice DependsOn(testBean1) is not clickable.
If it use the class name TestBean1 then that will work, but it won't work during the run time.
@Component
@DependsOn("TestBean1")
public class TestBean2 {}
Actually, the case with an upper case - @DependsOn("TestBean1") in your case - only works by accident due to the Java language tooling itself interpreting this as random string as a class name and searches for that class.
Will add proper support for navigating to the actual referenced bean definition. Just keep in mind that there might be multiple definitions for that bean being found in your project.
Okay, so navigation support (7ee4e07) as well as auto-completion for bean names (d8e067a) is in now. Closing this as fixed for upcoming 4.23.0 release.
Activity
lamplification commentedon May 25, 2024
@martinlippert , thank you for looking into this.
martinlippert commentedon May 27, 2024
Actually, the case with an upper case -
@DependsOn("TestBean1")in your case - only works by accident due to the Java language tooling itself interpreting this as random string as a class name and searches for that class.Will add proper support for navigating to the actual referenced bean definition. Just keep in mind that there might be multiple definitions for that bean being found in your project.
GH-1254: support for <go to definition> for bean names in @dependsOn …
GH-1254: add auto-completion for bean names inside of dependson annot…
martinlippert commentedon May 30, 2024
Okay, so navigation support (7ee4e07) as well as auto-completion for bean names (d8e067a) is in now. Closing this as fixed for upcoming 4.23.0 release.
martinlippert commentedon May 30, 2024
@lamplification Thanks again for reporting this and for proving a demo project. Much appreciated.
lamplification commentedon May 30, 2024
@martinlippert , thank you for the quick turn around!
martinlippert commentedon May 31, 2024
In VSCode, you could switch the extension install over to the pre-release to try this out already, btw.
lamplification commentedon May 31, 2024
@martinlippert , I switched to pre-release and that patch works like a charm! Thank you!
martinlippert commentedon May 31, 2024
Awesome, great to hear it works for you. Thanks for the feedback!