Specified class is an interface

Specified class is an interface  指定的类是接口

 

异常错误信息

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.xxxMapper]: Specified class is an interface
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:70) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1294) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	... 44 common frames omitted

在往上找堆栈信息

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'analysisService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxMapper' defined in file [D:\workspaces\y_R\cloud\analysis-receive-service\target\classes\com\xxx\mapping\XxxMapper.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxs.mapping.XxxMapper]: Specified class is an interface
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:325) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.14.RELEASE.jar:5.1.14.RELEASE]

每个段异常信息里都有 Specified class is an interface  翻译过来就是:指定的类是接口

网上百度找了下,大多是说什么Cntroller里的API接口没有加 @RequestParam注解,可以说 加了也不好使。

又好好读了一遍异常信息,发现是两个Mapper重名导致的。

解决步骤

找到重名的类,rename--> 重启 --> 运行成功

这就完了吗?如果你觉得这就完了,那你就可能永远停留在此!!!

 

源码分析

抛出异常的原因是什么?

 

 

 

你可能感兴趣的:(Java异常大杂烩)