org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
1 回答

慕碼人8056858
TA貢獻1803條經驗 獲得超6個贊
你的service使用spring容器管理了嗎,service使用@service指定bean名字,也可以默認。
UserService 默認就是userService.你的注解掃描包 包含了你的bean定義嗎。
Web層注入
@Autowired
@Qualifier("userService")
private UserService userService;
添加回答
舉報
0/150
提交
取消