Skip to content

Improve toString() for AbstractBeanDefinition and BeanMetadataAttribute #33579

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

Closed
sbrannen opened this issue Sep 23, 2024 · 0 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

To improve diagnostics, we should improve the String representations of bean definitions and bean metadata attributes.

The toString() implementation of AbstractBeanDefinition currently includes the bean class name in brackets class [...]; whereas, everything else is not in brackets and just uses an equals sign -- for example, scope=singleton.

With modern Spring applications that make heavy use of @Bean methods in @Configuration classes, bean definitions do not have a pre-configured bean class name. Thus, it makes sense to align the formatting of the bean class name with the formatting of other properties -- for example, class=....

With the recent introduction of @Fallback support, it would also be good to include the fallback flag in toString() alongside the primary flag.

The String representation of a BeanMetadataAttribute could also be improved to include the value in addition to the name.

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Sep 23, 2024
@sbrannen sbrannen added this to the 6.2.0-RC2 milestone Sep 23, 2024
@sbrannen sbrannen self-assigned this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant