Skip to content

Add support for generating resources linked to a feature #35862

@snicoll

Description

@snicoll

There is an inconsistent support in GeneratedContext at the moment. Source code benefits from GeneratedClasses with several helper to generate unique class names based on feature or feature component.

Resources, on the other hand, have no such link. At the moment we need to go through the GeneratedFiles contract which only offers bare bone utilities to add a file whose name is provided by the caller.

Two use cases that this would help with:

  1. If a resource needs to be generated based on Class (like a metadata file, Spring Data does this) then GeneratedResources could take care of the naming (+ location) based on the type and the name of the feature.
  2. Resources are more likely to be idempotent. If a resource is generated based on the type, the type will not change based on the state of the ApplicationContext. This is again the case for Spring Data and we should offer a way to gently ignore if the file has always been generated.

See also #35855 for an example of a file with a unique name that will cause such problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions