Skip to content

could we source and default the name from the bean name by having the various types implement BeanNameAware? #5149

@joshlong

Description

@joshlong

now that Spring Batch is not tied to any persistence mechanism and now that the default is actually resourceless, could we provide some sensible defaults for the names?

for example, StepBuilder and JobBuilder can both be used without specifying a name (I love this!) but some of the builders like FlatFileItemBuilder can not.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.infrastructure.item.file.FlatFileItemReader]: Factory method 'reader' threw exception with message: A name is required when saveState is set to true.

if we dropped the assertion in the builder and then had the produced FlatFileItemReader implement BeanNameAware so that if the name is not explicitly provided we can default it to the bean name, it would be nice. people could provide their own names, but get a sensible default otherwise.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions