Spring 注入问题

@Autowired
public InfoService infoService;

@ModelAttribute
private Info get(@RequestParam(required = false) String id) {
    Info info = null;
    if (StringUtils.isNotBlank(id)) {
        info = infoService.get(id);
    }
    if (info == null) {
        info = new Info();
    }
    return info;
}
//发现怎么也注入不进去 改为public 就可以了

你可能感兴趣的:(Spring 注入问题)