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
{{ message }}
Repository navigation
Add support for spring potential injection points discovery while indexing #994
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 ?
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.
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.
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.
Activity
gayanper commentedon Mar 8, 2023
@martinlippert I would like get your feedback on this feature.
martinlippert commentedon Mar 9, 2023
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.annotationannotations as well.martinlippert commentedon Mar 15, 2023
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 commentedon May 12, 2023
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.