spring annotion找不到jar里的类导致NoSuchBeanDefinitionException错误

在维护老项目时,修改jar包重新打包后遇到启动时的NoSuchBeanDefinitionException错误。问题源于@Service注解的userService无法被spring的context:component-scan找到。通过对比发现,将类打包进rar文件则不会出错。解决方案是在打包时选择添加"Add directory entries"选项。
摘要由CSDN通过智能技术生成

最近在维护一个老项目,结果修改了一个jar包,重新打包后,启动时发生了如下错误:

32417 [main] 13 Aug 2012 10:46:21,318 ERROR org.springframework.web.context.ContextLoader  initWebApplicationContext - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.oss.service.UserService com.oss.ws.server.impl.UserServiceImpl.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.oss.service.UserService] is defined: Unsatisfied dependency of type [class com.oss.service.UserService]: expected at least 1 matching bean
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值