zl程序教程

您现在的位置是:首页 >  其它

当前栏目

@EnableAsync annotation metadata was not injected

not was metadata annotation
2023-09-27 14:23:13 时间
今天将老的项目放在Myeclipse2015中运行时,报错了。
错误原因:

 

在spring的配置文件applicationContext.xml中, 配置包扫描器时, 使用了*, 想扫描所有的包; 而这种方式有可能扫描到spring自带的包, 造成错误(自我理解, 不对的话求教育)

改动前:

<!-- 包扫描器 -->  
<context:component-scan base-package="*"/>  


改动后 :

<!-- 包扫描器 -->  
<context:component-scan base-package="service.*,dao.*,action.*"/>