0
我有一個問題,這個程序Spring MVC中沒有默認構造函數發現
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cdmiService': Cannot resolve reference to bean 'badRequestException' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'badRequestException' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.snia.cdmiserver.exception.BadRequestException]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.snia.cdmiserver.exception.BadRequestException.<init>()
和我的XML如下:
<bean id="badRequestException" class="org.snia.cdmiserver.exception.BadRequestException"/>
的BadRequestException.java如下:
public class BadRequestException extends RuntimeException {
public BadRequestException(String message) {
super(message);
}
public BadRequestException(String message, Throwable cause) {
super(message, cause);
}
public BadRequestException(Throwable cause) {
super(cause);
}
我該如何解決這個問題?添加一個默認的建築師或編輯XML文件?
最有趣的事情在這裏:你爲什麼要創建一個異常類豆? –