Skip to content

vscode @DependsOn navigation not linked #1254

Closed

Description

@lamplification

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 {}

demo.tar.gz

Activity

  1. added
    for: eclipse
    for: vscode
    and removed on May 23, 2024
  2. added this to the 4.23.0.RELEASE milestone on May 23, 2024
  3. lamplification commented on May 25, 2024

    @lamplification
    Author

    @martinlippert , thank you for looking into this.

  4. martinlippert commented on May 27, 2024

    @martinlippert
    Member

    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.

  5. added 2 commits that reference this issue on May 28, 2024
  6. martinlippert commented on May 30, 2024

    @martinlippert
    Member

    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.

  7. martinlippert commented on May 30, 2024

    @martinlippert
    Member

    @lamplification Thanks again for reporting this and for proving a demo project. Much appreciated.

  8. lamplification commented on May 30, 2024

    @lamplification
    Author

    @martinlippert , thank you for the quick turn around!

  9. martinlippert commented on May 31, 2024

    @martinlippert
    Member

    In VSCode, you could switch the extension install over to the pre-release to try this out already, btw.

  10. lamplification commented on May 31, 2024

    @lamplification
    Author

    @martinlippert , I switched to pre-release and that patch works like a charm! Thank you!

  11. martinlippert commented on May 31, 2024

    @martinlippert
    Member

    Awesome, great to hear it works for you. Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: code completiontheme: spring index & symbolstype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions