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

Deprecate support for injecting DynamicPropertyRegistry in favor of DynamicPropertyRegistrar beans #41996

Closed
wilkinsona opened this issue Aug 22, 2024 · 4 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

This follows up on #41839, and in particular:

I've put a work-around in for M2, but I think we might need a better long-term solution. In hindsight, we should probably not have used DynamicPropertyRegistry but instead have our own interface.

@snicoll
Copy link
Member

snicoll commented Aug 23, 2024

A DynamicPropertyRegistry bean does not provide any built-in resolution mechanism and the @Bean method that's invoked to mutate the Environment may easily be invoked after the related component has been created. This may cause issues that are very hard to track. As a framework mechanism without an intuitive (or out-of-the-box) mechanism to deal with this issue, one should wonder if it should be exposed at all until it does.

We need to have a discussion with the framework team about this.

@wilkinsona
Copy link
Member Author

I've prototyped some changes to Boot that make use of Framework's new DynamicPropertyRegistar. The prototype currently needs to use reflection as Framework's DynamicPropertyRegistrarBeanInitializer is package-private. I've opened spring-projects/spring-framework#33593 to see if Framework can provide use with an SPI for bootstrapping the DynamicPropertyRegistrar support outside of the test context framework.

@wilkinsona wilkinsona changed the title Reconsider use of DynamicPropertyRegistry in spring-boot-testcontainers Deprecate support for injecting DynamicPropertyRegistry in favor of DynamicPropertyRegistrar beans Sep 25, 2024
@wilkinsona wilkinsona added type: enhancement A general enhancement status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team and removed for: team-meeting An issue we'd like to discuss as a team to make progress labels Sep 25, 2024
@wilkinsona
Copy link
Member Author

The bean initializer's now public so the prototype no longer needs to use reflection. The prototype's been updated to this effect. I think this is pretty close now but I'd like to have another round of discussion with the team, particularly around how we bring the deprecation to people's attention.

@wilkinsona wilkinsona added for: team-meeting An issue we'd like to discuss as a team to make progress and removed status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team labels Sep 27, 2024
@philwebb philwebb removed the for: team-meeting An issue we'd like to discuss as a team to make progress label Oct 2, 2024
@wilkinsona
Copy link
Member Author

We'd like a failure by default rather than just a warning. We'll then provide a property to change this behavior with supported values being something like fail, warn, or ignore. fail would be the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants