Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gayanper opened this issue Mar 8, 2023 · 4 comments
Closed
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: spring index & symbols type: enhancement

Comments

@gayanper
Copy link
Contributor

gayanper commented Mar 8, 2023

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 ?

@gayanper
Copy link
Contributor Author

gayanper commented Mar 8, 2023

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

@martinlippert martinlippert added theme: spring index & symbols status: needs-discussion for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode and removed status: waiting-for-triage labels Mar 9, 2023
@martinlippert martinlippert added this to the Backlog milestone Mar 9, 2023
@martinlippert
Copy link
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.

@martinlippert
Copy link
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.

@martinlippert
Copy link
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
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: spring index & symbols type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants