0
我收到這個錯誤,試圖從Spring RestController反序列化一些XML。Spring XML - 沒有字符串參數構造函數/工廠方法來反序列化字符串值
10:32:20.275 [main] WARN org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not construct instance of com.example.SomeThing: no String-argument constructor/factory method to deserialize from String value ('AAAA')
這裏是類(改變名稱和包)
public final class SomeThing{
public static final SomeThing AAAA = create("AAAA");
public static SomeThing create(final String value) {
SomeThing result = new SomeThing();
result.setValue(value);
return result;
}
}
那麼,如何改變這一類,所以它能夠被反序列化?