经常我们在controller中引入service中用到的注解是Resource和Autowired
如果我们的service类名有两个首字母大写,会导致spring注入时bean的id第一个首字母变小写,
此时映射时,造成get和set找不到。如下例子:
private CChello cChello;
private String wordHello;
public CChello getcChello() { //按get,set机制,应第一个首字母大写,为getCChello,
return cChello;
}
public void setcChello(CChello cChello) {
this.cChello = cChello;
}
public String getWordHello() {
return wordHello;
}
public void setWordHello(String wordHello) {
this.wordHello = wordHello;
}
要解决这个,最好类名不要两个字母连着大写,还有可以指定name属性,就可以进行。
这里有之前前辈的原文解答:https://blog.csdn.net/bubles777/article/details/65629273