Spring更改了从4.3到5版本的bean

MeB*_*Guy 9 java spring dependency-injection

我有一个大的弹簧应用程序使用注释在春季4.3.13工作正常,我期待更新到春季5.我得到各种故障布线豆,看起来像典型的:

Unsatisfied dependency expressed through field 'pcoDAO'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.acme.dao.impl.contracts.PotentialChangeOrderDAO' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Run Code Online (Sandbox Code Playgroud)

启用弹簧调试日志记录,只能阻止此额外行

Failed to meta-introspect annotation interface org.springframework.beans.factory.annotation.Autowired: java.lang.NullPointerException
Run Code Online (Sandbox Code Playgroud)

它不像所有@Autowired字段都失败,只是这个(到目前为止).bean由接口指定,并且实现位于接口的子包中,但之前再次使用.接口的包直接在上下文中指定:component-scan base-package ="com.acme.package.of.interface"

再次这在4.3.13中工作正常,唯一的变化是spring被升级到5.0.5-RELEASE.

他们对春天如何找到豆类有任何已知的变化吗?或者有关于此的任何文件?

孙兴斌*_*孙兴斌 8

看似Spring 5.0.5的一个bug,已在5.0.6中修复,请参阅AnnotationUtils.getAnnotation中需要的Null检查

  • 谢谢,看起来很可能.现在只需等待5.0.6,我猜 (2认同)