嚴重: Error building bean
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cn.it.shop.model.Category': Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: : No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {
}
嚴重: Could not create and/or set value back on to object
java.lang.InstantiationException: cn.it.shop.model.Category
at java.lang.Class.newInstance(Class.java:359)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:158)
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:204)
at com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.createObject(InstantiatingNullHandler.java:163)
嚴重: Exception occurred during processing request: attempt to create saveOrUpdate event with null entity
java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity
at org.hibernate.event.spi.SaveOrUpdateEvent.<init>(SaveOrUpdateEvent.java:62)
at org.hibernate.event.spi.SaveOrUpdateEvent.<init>(SaveOrUpdateEvent.java:45)
at org.hibernate.internal.SessionImpl.update(SessionImpl.java:731)
at org.hibernate.internal.SessionImpl.update(SessionImpl.java:726)
at cn.it.shop.service.impl.CategoryServiceImpl.update(CategoryServiceImpl.java:46)
- 原因:
struts2的model driven機制采用了反射機制
反射機制要求用戶類必須要有無參構造方法
當一個類沒有構造方法時,java缺省為其加一個無參構造方法
當你為一個類添加構造方法時,實際上就禁掉了java缺省為類添加無參構造方法這個動作.
也就是說當你為類添加構造方法后,你的類實際上就沒有無參構造方法了,也就不支持反射機制了
文章列表