org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘updateCostAc

The specific problem is as follows, roughly it is to use Bean annotation, and then this class is not found. With source code

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'updateCostAction' defined in file [D:\Work\IdeaWork\out\production\Spring02\web\WEB-INF\classes\com\action\UpdateCostAction.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.action.UpdateCostAction]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.action.UpdateCostAction.<init>()

 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
 at com.test.TestAop.test02(TestAop.java:30)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
 at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
 at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
 at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
 at org.juni

Baidu has some experience and found that it doesn't apply to me. It can only be said that when this class is called, a subclass will be created by default, and the subclass overrides the method of this class. Only the parameter construction is not possible, and the non-parameter constructor can run normally. At present, it will only explain this way, welcome to come to explain

Attached picture after adding

Guess you like

Origin blog.csdn.net/zai_deng_dai/article/details/112371220