java的ssm项目采坑,ssm项目设计了多个maven模块包含domain、dao、service、web等四个模块
maven项目启动的时候就报错
Error creating bean with name 'StudentInfoController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean 'com.cloud.xp.manager.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
意思是创建“StudentInfoController”bean对象失败,开始以为没有加注解或者是加的注解错误

根据图可以看到,@Controller注解加的并没有错误
经过两天的csdn采坑,终于自己灵机一动 ,发现dao、service模块打包的方式是war包,都修改为jar包的方式结果能正常访问了。
本文记录了作者在Java SSM项目中遇到的问题及解决过程。项目使用多个Maven模块,在启动时出现未找到特定Bean的错误。通过调整DAO和服务模块的打包方式从WAR改为JAR,成功解决了依赖问题。
4万+

被折叠的 条评论
为什么被折叠?



