springboot **Controller Autowired required a single bean, but 2 were found
来源:互联网 发布:我友网络 编辑:程序博客网 时间:2024/06/06 15:35
package com.lee;import ch.qos.logback.core.net.SyslogOutputStream;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.boot.context.properties.EnableConfigurationProperties;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class SystemController { @Autowired @Qualifier("userVo")//加上这个,或者在实体类前面加上@primary的标签就不会报 SystemController Autowired required a single bean, but 2 were found UserVo user; @RequestMapping("/index") public String toIndex(){ return user.toString(); } @Autowired MyConfigVo myconfig; @RequestMapping("/myconfig") public String toMyConfig(){ return myconfig.toString(); }}
阅读全文
0 0
- springboot **Controller Autowired required a single bean, but 2 were found
- expected single matching bean but found 2
- expected single matching bean but found 2
- expected single matching bean but found 2
- expected single matching bean but found 2
- pod安装AFNetworking3.0遇到dependency were found, but they required a higher minimum deployment target
- Specs satisfying the `Alamofire (~> 4.2.0)` dependency were found, but they required a higher minimu
- Specs satisfying the `Alamofire` dependency were found, but they required a higher minimum deploymen
- expected single matching bean but found 2 注解继承冲突
- spring注解错误-expected single matching bean but found 2
- 多数据源报错 expected single matching bean but found 2
- Injection expected single matching bean but found
- spring boot but 2 were found
- No qualifying bean of type is defined: expected single matching bean but found 2
- springboot 报错Field XXX required a bean of type XXX that could not be found.
- spring依赖注入单元测试:expected single matching bean but found 2
- spring依赖注入单元测试:expected single matching bean but found 2
- 开发:异常收集之 expected single matching bean but found 2
- my sql部分重要语句示例
- 大学生该怎么活,才有意义。
- Linux系统安装之前
- 二维数组动态改变下拉菜单内容
- mysql 主从复制环境搭建
- springboot **Controller Autowired required a single bean, but 2 were found
- SVG文本
- Java 执行数据库存储过程,并带返回值
- linux中man前面的代号代表的意义
- Longest Substring Without Repeating Characters
- android的handler机制
- POJ3252Round Numbers(数位DP)
- iOS-80-解决主页tableview顶部多出一块
- css标签大全