I have POJO like where I have a BigDecimal field:
public class Foo implements Serializable {
private BigDecimal amount;
}
Run Code Online (Sandbox Code Playgroud)
I want to have the BigDecimal value up to 2 decimal place only. Is there any annotation exist using which I can directly change it's value at the field level itself? I cannot change it's type as well.
ObjectMapper尽管它可以通过 getter在应用程序内完成。
java bigdecimal jackson deserialization json-deserialization
我正在使用CompletableFuture,并对异常处理有疑问.
我有这样的代码,如果任何validate()或process()方法抛出异常,那么它由ExceptionHandler处理.但是,当我像这样使用CompletableFuture时,抛出的异常包含在CompletionException中.我可以知道如何确保在那里调用我的ExceptionHandler而不是获得CompletionException?
CompletableFuture<Response> response = CompletableFuture
.supplyAsync(() -> {
validationService.validate(request);
return myService.process(request, headers);
});
Run Code Online (Sandbox Code Playgroud) 在我现有的应用程序中使用 Tomcat 9 设置采用 openjdk 8 时,出现以下错误
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/stream/buffer/AbstractCreatorProcessor
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:363)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:321)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:211)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:207)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:114)
at javax.xml.ws.Service.<init>(Service.java:77)
at javax.xml.ws.Service.create(Service.java:707)
at org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.createJaxWsService(LocalJaxWsServiceFactory.java:162)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:357)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:339)
Run Code Online (Sandbox Code Playgroud)
它与 Oracle JDK 一起工作正常,我对 openjdk 有什么遗漏吗?