Skip to content

Support for null bean in functional bean registration [SPR-17057] #21595

Closed

Description

@spring-projects-issues

Dave Syer opened SPR-17057 and commented

You can return null from a @Bean method and it does some clever stuff internally using a final package private class (which is therefore inaccessible to users) called NullBean. The result is just a bean that cannot satisfy any dependencies. It would make sense if the functional form of the same bean could do the same trick, either returning null from the Supplier or some other contract that allows the BeanFactory to behave the same way.


Affects: 5.0.7

Issue Links:

Referenced from: commits 28f7b26

Activity

  1. spring-projects-issues commented on Jul 18, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Indeed, in particular with 5.1's refined null bean semantics, a null-returning instance supplier should simply resolve to NullBean as well (instead of rejecting the null return value there).

  2. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions