我想知道 @Produces Javadoc 中描述的这一要求:
If a producer method sometimes returns a null value, or if a producer field sometimes contains a null value when accessed, then the producer method or field must have scope @Dependent.
范围和产生的值(value)之间有什么关系?
最佳答案
生产者方法上的作用域注释理论上描述了正在生成的事物。这句话的意思是,只有当@Dependent注解你的生产者方法时,它的返回值才可能为null。换句话说,当由生产者方法或生产者字段生成时,null
对象只能是 @Dependent
范围的成员。
关于java - CDI @Produces Javadoc 需求解释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60631983/