正如主题所说:我不应该使用vaadin和spring boot addon自动装配@SpringView注释类。我得到了一个不满意的依赖异常。添加@SpringComponent不起作用。帮助赞赏
编辑: 我只想要一个被注释的类@SringView(autowireing @SpringCOmponent出色地工作) 我挖得更深,发现它无法实例化[com.vaadin.spring.internal.ViewCache]
代码将是:
@SpringView
Foo{
}
完全异常是:
Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [cuscus.client.ui.presenter.LoginPresenter]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewCache' defined in com.vaadin.spring.VaadinConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.vaadin.spring.internal.ViewCache]: Factory method 'viewCache' threw exception; nested exception is java.lang.NullPointerException] with root cause
问候克里斯
答案 0 :(得分:0)
通常会发生此空指针异常,因为当前的UI实例在bean实例化时未初始化。要解决此问题,请将@SpringComponent和@UIScope注释一起用于(例如)注入UI类的视图。