-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Juergen Hoeller opened SPR-15028 and commented
Along the lines of Guice (https://github.com/google/guice/wiki/UseNullable), we can easily detect @Nullable annotations and automatically mark method parameters and dependency descriptors as optional, i.e. not required, injecting null instead of throwing an UnsatisfiedDependencyException. This is particularly useful with JSR-330's @Inject where not @Autowired-style required attribute is available at the injection annotation level, as an alternative to using Java 8's java.util.Optional (which Spring supports for a while already). This also nicely goes along with our support for nullable type declarations in Kotlin.
Issue Links:
- Support Kotlin nullable information for @Autowired and @Inject [SPR-14951] #19518 Support Kotlin nullable information for
@Autowiredand@Inject - Support for java.util.Optional with @Inject (a la @Autowired's required=false) [SPR-11833] #16452 Support for java.util.Optional with
@Inject(a la@Autowired's required=false)
Referenced from: commits 12aa14d
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement