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;
@RestController
public 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();
}
}
springboot **Controller Autowired required a single bean, but 2 were found
最新推荐文章于 2024-04-29 02:03:12 发布