Skip to content

Make strategies in EnvironmentPostProcessorApplicationListener pluggable #23230

Open
@dsyer

Description

@dsyer

There is a public constructor EnvironmentPostProcessorApplicationListener(EnvironmentPostProcessorsFactory) but currently no way to use it except with byte code tricks or monkey patches - the current implementation is to use SpringFactoriesLoader to instantiate using the default constructor and take it from there.

What we might need is an abstraction that can be created via SpringFactoriesLoader but which will back off if it finds one is already present. At a granular level this could be something simple like a composite version of EnvironmentPostProcessorApplicationListener that picks the first thing that is non-null (or some other tie breaker). Or it could be a new factory abstraction that is more generic and can be applied to other things in spring.factories, and behaves similarly - backs off if another instance is provided with higher priority by some definition.

EnvironmentPostProcessorApplicationListener also contains this new abstractions of BootstrapRegisty and Instantiator with no option to override. Maybe those could be the focus of the new abstraction (being able to replace or override some or all calls to the DefaultBootstrapRegistry, for example)?

See also #15704 and #16880

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: blockedAn issue that's blocked on an external project changetheme: aotAn issue related to Ahead-of-time processingtype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions