Skip to content

Add support for spring potential injection points discovery while indexing #994

Closed

Description

@gayanper

When indexing symbols today we only index symbols which are annotated by known spring related annotations. For example

@RestController
public class StockController {
    public StockController(@Autowired StockRepository repo){}
}

Both the symbols will be available in symbols. This information could be used to show a potential hierarchy in the spring dash board or provide actions to navigate or find reference. But if we write the same code like

@RestController
public class StockController {
    public StockController(StockRepository repo){}
}

Now the constructor injection is not identified as a symbol. But ideally this will be considered as injection point (like it was annotated with Autowired) at runtime.

So the suggestion / question is, could we identify this constructors as similar to @Autowired symbols when we satisfy the spring's injection criteria for implicity constructor injection ?

Activity

  1. gayanper commented on Mar 8, 2023

    @gayanper
    ContributorAuthor

    @martinlippert I would like get your feedback on this feature.

  2. added
    for: eclipse
    for: vscode
    and removed on Mar 9, 2023
  3. added this to the Backlog milestone on Mar 9, 2023
  4. martinlippert commented on Mar 9, 2023

    @martinlippert
    Member

    Hey @gayanper, thanks a lot for these thoughts and the enhancement requests. Makes a lot of sense to me. We already generate symbols for things that are not annotated (e.g. in the case of Spring Data repositories), so this idea of indexing these implicit injection points sounds like a great idea.

    This raises the question whether we should distinguish injection points somehow from other annotations and Spring symbols and give a bit more structure to them than what we have nowadays. And while doing that, we should probably revisit your PR from back then about indexing certain javax.annotation annotations as well.

  5. martinlippert commented on Mar 15, 2023

    @martinlippert
    Member

    I created #1006 for initial work on a new internal Spring component model that would contain this injection point information (as well as other details). Please take a look and add your thoughts around this model + corresponding API.

  6. martinlippert commented on May 12, 2023

    @martinlippert
    Member

    The initial work on the new index covers this, the information for injection points that the index contains for beans takes since case into account now. This is not yet surfaced anywhere, so this doesn't show up in symbols or any other location yet, but I think we can close this item here as fixed and open another one that deals with the overall thoughts and steps towards surfacing the new index information in symbols and elsewhere.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions