Skip to content

Remove unnecessary constructor to align with other AutoConfigurations#46239

Closed
quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-176
Closed

Remove unnecessary constructor to align with other AutoConfigurations#46239
quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-176

Conversation

@quaff

@quaff quaff commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 2, 2025
@philwebb

philwebb commented Jul 3, 2025

Copy link
Copy Markdown
Member

Those are actually intentional and we plan to adopt them more widely (but we're not ready to do that yet so please don't submit a PR :) )

The idea is that the class is public so that it can be excluded, but the constructor is package private to stop folks using or extending them directly because we consider auto-configuration classes to not be public API.

@philwebb philwebb closed this Jul 3, 2025
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 3, 2025
@quaff

quaff commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

@philwebb Is it possible to generate package private constructor by annotation processor?

@philwebb

philwebb commented Jul 8, 2025

Copy link
Copy Markdown
Member

I think we'd rather just keep it simple and add them manually.

@wilkinsona

Copy link
Copy Markdown
Member

I thought we'd decided on making them final rather than adding package-private constructors, hence the update to the title of #32883.

@philwebb

philwebb commented Jul 8, 2025

Copy link
Copy Markdown
Member

I can't remember where we landed. Using final would stop subclassing, using a package private constructor would stop folks delegating. Perhaps it's a step too far.

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

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants