Skip to content

Allow convenient addition of custom Converter types against ConfigurableEnvironment / ConfigurablePropertyResolver [SPR-8389] #13036

@spring-projects-issues

Description

@spring-projects-issues

Chris Beams opened SPR-8389 and commented

Excerpt from email conversation with Dave Syer:

Incidentally, how can I register
the FooConverter for the above use case?

Good question. You can do it through the Environment API as well. Technically, you can do it at any point in the lifecycle, but it would be most correct to do it pre-refresh(). There is a convenience issue here, in that the ConfigurableEnvironment interface exposes a ConversionService getConversionService(); method, but does not expose a method returning a ConverterRegistry. This means that the user would need to cast:

((ConverterRegistry)env.getConversionService()).addConverter(FooConverter.class);

We can certainly consider making that more convenient.


Attachments:

Referenced from: commits 8227cb6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions