Description
Hi, this is a first-timers-only
issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.
If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
If you have contributed before, consider leaving this one for someone new, and looking through our general ideal-for-contribution
issues. Thanks!
Background
The @Endpoint
annotation identifies a type as being an actuator endpoint. Spring Boot's actuator infrastructure looks for beans that have this annotation.
Problem
When Spring Cloud's @RefreshScope
is used on an @Endpoint
bean, it registers another bean for that endpoint with the bean name prefixed by scopedTarget
. Spring Boot discovers this bean as well when looking for @Endpoint
beans an fails because it finds two endpoint beans with the same ID.
Solution
We should filter out the scopedTarget.
version of the endpoint bean using ScopedProxyUtils.isScopedTarget(name)
as was done for a different type of bean in this commit.
The code for discovering endpoint beans can be found here.
The test can register two beans for the same @Endpoint
class, one with the name prefixed by scopedTarget.
and assert that only the original @Endpoint
bean is discovered.
Steps to Fix
- Claim this issue with a comment below and ask any clarifying questions you need
- Set up a repository locally following the Contributing Guidelines
- Try to fix the issue following the steps above
- Commit your changes and start a pull request.