我正在努力解决应该有效但无效的事情......
我的控制器中有这个映射:
@RequestMapping(value = "/keys", method = RequestMethod.POST)
@Consumes(MediaType.APPLICATION_JSON)
public ResponseEntity<Void> parseKeyList(keyList keyList) {
return new ResponseEntity<Void>(HttpStatus.OK);
}
与简单的类
@XmlRootElement
public class keyList {
private String keys;
public String getKeys() {
return keys;
}
public void setKeys(String keys) {
this.keys = keys;
}
}
我正在发送这个简单的 JSON 帖子:
{"keys": "This is my key list"}
但我正在null
进入keys
.
根据要求,原始调度程序-servlet:
<context:component-scan base-package="com.api" /> <!-- <mvc:resources mapping="/*" location="/WEB-INF/pages/" /> --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/pages/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean>