org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userControll
异常出现的场景:使用IDEA+MAVEN搭建SSM框架
这个异常困了我好几个小时,刚从坑里爬出来,特意做个标记,希望对大家有所帮助~
主要异常是:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization
of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: com.Service [Xlint:invalidAbsoluteTypeName]
解决办法是:
找到定义事务AOP配置的地方,如下,前面的是错误的,后面的才是正确的:
图1 错误的示范
图2 正确的示范
怪我之前愚昧,看见连续的两个".*"就下意识地觉得不必要……手贱……删除了。
这里补充一下知识点:
(* com.Service.*.*(..))中几个通配符的含义:
|第一个 * —— 通配 随便率性返回值类型|
|第二个 * —— 通配包com.Service下的随便率性class|
|第三个 * —— 通配包com.Service下的随便率性class的随便率性办法|
|第四个 .. —— 通配 办法可以有0个或多个参数|
参考博客【非常感谢博主的分享】:
http://blog.****.net/shipeng22022/article/details/40795095