项目已启动就报错误的创建bean
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroFilter' defined in class path resource [com/xxxxx/admin/shiro/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'shiroFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [com/xxxxxx/admin/shiro/config/ShiroConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]: Factory method 'securityManager' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'loginByPasswordRealm': Unsatisfied dependency expressed through field 'getAdminService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.xxxxxx.service.GetAdminService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
实际上一开始项目是没有问题的 然后我添加了一个模块 在创包写代码之后进行启动测试就报错误了 但是我没加这个模块的时候项目是完全没有问题的 而且新模块开发代码是没有任何问题的 但是就是启动就错误的创建bean 而且所指向的类也不对 不是我新创的模块里面的代码 ..... 经过公司大佬的点播之后 看到自己新加模块所创建的包以及里面的代码与主启动类所在的位置是同级的 所以扫描不到新模块下面的加了注解的代码 需要去主启动类上添加扫描器 或者在 新创建的模块将代码所在的包放在主启动类所在的包的层级下的再下面一层就可以了