如果pom文件中存在此依赖,将其注释掉
<!--<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.5.2</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.5.2</version></dependency>-->
Cotroller代码
@Controller
@RequestMapping(value = "/ML")
public class MLModelCtronller {
@RequestMapping(value = "/getPredic",produces = "application/json;charset=UTF-8",method = RequestMethod.POST)@ResponseBodypublic Object getPredict(@RequestBody Device device) {
String a = device.getDay();String b = device.getTemperature();String c = device.getFlowSpeed();String d = device.getWaterPressure();if ((isValidateNumbers(a) && isValidateNumbers(b) && isValidateNumbers(c) && isValidateNumbers(d))) {
return 12.2;}return null;}
然后使用PostMan测试