我在Spring Boot 2.0.4.RELEASE中使用自定义端点
我的自定义端点如下,
@Endpoint(id = "mycaches" ,enableByDefault=true)
@Component
public class CacheEndpoint {
@WriteOperation
public String invalidateCacheKeys(@Selector String arg0,List<String> cacheList) {
System.out.println(cacheList);
return "Success";
}
}
基本上,我想接收一组键并进行相应的处理。
当我尝试通过其余客户通过以下方式提交请求
[
"1","2","3"
]
我收到以下错误。
Response status 400 with reason "Failed to read HTTP message"; nested exception is org.springframework.core.codec.DecodingException: JSON decoding error: Cannot deserialize instance of `java.util.LinkedHashMap` out of VALUE_STRING token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.LinkedHashMap` out of VALUE_STRING token
at [Source: UNKNOWN; line: -1, column: -1]
如果我使用以下输入内容提交,
{
"cacheList": ["1","2","3"]
}
我收到以下错误,
Response status 400 with reason "Failed to read HTTP message"; nested exception is org.springframework.core.codec.DecodingException: JSON decoding error: Cannot deserialize instance of `java.lang.String` out of VALUE_STRING token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of VALUE_STRING token
at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: java.util.LinkedHashMap["cacheList"])
有人可以帮助我解决问题。