首页 > 其他分享 >Error creating bean with name 'userController': Unsatisfied dependency expressed through f

Error creating bean with name 'userController': Unsatisfied dependency expressed through f

时间:2024-06-03 10:22:03浏览次数:14  
标签:Unsatisfied creating Service springframework field bean through userController n

SSM整合项目搭建时,项目启动报错,报错内容如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atguigu.edu.service.IUserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

上网查询:

1、有可能是我对应的实现类没有@Service和@Transational注解,而我的实现类上已经写了

 2、控制器上没有@Controller注解,我同样写了。

 3、控制器内调用Service对象,需要加上@Autowired,同样没问题

 

 

 

4、后来,经过我不断努力,终于发现原来是我的自动扫描Service放错地方了,不应该放在applicationContext.xml中,而是要放在springMVC配置文件中。

 

5、重新启动项目,问题解决,记录一下,希望以后不要再遇到了,哈哈!!!!

 

标签:Unsatisfied,creating,Service,springframework,field,bean,through,userController,n
From: https://www.cnblogs.com/zhuzhenxi-123/p/18228275

相关文章

  • 报错信息:Unable to make field private final java.lang.Class java.lang.invoke.Seri
    jdk版本与当前MyBatisPlus版本不兼容解决方法:1.升级MyBatisPlus的版本。2.或者使用以下方法--add-opensjava.base/java.lang.invoke=ALL-UNNAMED......
  • java.lang.UnsatisfiedLinkError: no taos in java.library.path, TDengine 访问数
     TDengine linux部署连接驱动问题: java.lang.UnsatisfiedLinkError:notaosinjava.library.path解决方案有有两种:方法一:使用原生的连接需要安装客户端,docker应用的话需要安装tdengine客户端到相应应用容器里面:windows端的需要安装tdengine客户端注意使用driver驱动......
  • 【Swing】JTextField设置光标
    1、设置焦点焦点默认是在窗体的第一个组件上UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());JFramewindow=newJFrame();JPanelpanel=newJPanel(newFlowLayout(FlowLayout.LEFT));JButtonmessageDialog=newJButton("消息框");messageDi......
  • 解决Java.lang.NoSuchFieldException异常:全面指南 ️
    解决Java.lang.NoSuchFieldException异常:全面指南......
  • Error creating bean with name ‘dataSource‘ defined in class path resource解决
    报错信息ERROR3592—[restartedMain]o.s.boot.SpringApplication:Applicationrunfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname‘dataSource’definedinclasspathresource[org/springframework/boot/autoconfi......
  • MySQL按指定顺序排序(order by field的使用)
    新建t表CREATETABLE`t`(`id`intNOTNULLAUTO_INCREMENT,`c`intDEFAULTNULL,`name`varchar(255)COLLATEutf8mb4_general_ciNOTNULLDEFAULT'',PRIMARYKEY(`id`))ENGINE=InnoDBDEFAULTCHARSET=utf8mb4COLLATE=utf8mb4_general_ci;存......
  • elasticsearch使用Sort排序时Please use a keyword field instead.
    具体报错信息ElasticsearchStatusException[Elasticsearchexception[type=search_phase_execution_exception,reason=allshardsfailed]];nested:ElasticsearchException[Elasticsearchexception[type=illegal_argument_exception,reason=Textfieldsarenotoptimised......
  • MySQL 中 FIELD() 自定义排序
    在MySQL中,你可以使用ORDERBYFIELD()来自定义排序顺序。这个函数允许你指定字段的自定义排序顺序,而不是默认的升序或降序排序。以下是一个简单的例子:假设你有一个表格叫做products,其中有一个字段叫做category,你想按照特定的类别顺序进行排序,比如'Electronics','Clothing......
  • 1250 - Table 'd' from one of the SELECTs cannot be used in field list
    1问题描述sql数据库查询接口union后orderby某字段,提示错误“1250-Table'd'fromoneoftheSELECTscannotbeusedinfieldlist“。移除orderby条件,就不会报错,但是不满足按照某个字段排序。 2方案解决修改排序条件为:orderbystatId即可。(union后的结果是字段......
  • NetSuite-Get-specific-Custom-Record-Types-and-related-sub-Custom-Fields-CarlZeng
    NetSuite:GetspecificCustomRecordTypesandrelatedsubCustomFields背景以前当使用search.create({})来获取数据时,我们需要制定特定的数据返回列;例如:search.createColumn(options)而query可以使用SELECT*FROM来动态返回所有的数据列(这在有的时候是一个优点),那么如......