在初始化spring事务部分碰到该错误, 详细错误信息如下:
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:45) at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
错误原因:
在spring的配置文件applicationContext.xml中, 配置包扫描器时, 使用了*, 想扫描所有的包; 而这种方式有可能扫描到spring自带的包, 造成错误(自我理解, 不对的话求教育)
改动前:
[html]
view plain
copy
<context:component-scan base-package="*"/>
改动后(具体指定了要扫描的包):
[html]
view plain
copy
<context:component-scan base-package="com.git.*"/>