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文件?
最有趣的事情在这里:你为什么要创建一个异常类豆? –