我正在控制台中运行 spring boot jar
java -jar -Dspring.profiles.active=dev [name].jar
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会出现此错误:
无法访问 jarfile .profiles.active=
我使用的是 spring Spring boot 2.1.0。
public Mono<ServerResponse> getConvertXmlToJson(ServerRequest serverRequest) {
Mono<String> requestString = serverRequest.bodyToMono(String.class);
Mono<String> response = this.convertFormatService.convertXmlToJson(requestString);
return response.subscribeOn(elastic()).flatMap(rta -> ok()
.contentType(APPLICATION_JSON_UTF8)
.body(fromObject(rta)))
.switchIfEmpty(ServerResponse.badRequest().build());
}
Run Code Online (Sandbox Code Playgroud)
在其他 bean 中调用此方法
private Mono<String> converter(String function, Mono<String> stringToConverter, String setting) {
log.info("salida, {}", stringToConverter.block());
try {
Object result = invocable.invokeFunction(function, stringToConverter, setting);
log.info("{}", result);
return Mono.just((String) result);
} catch (Exception e) {
throw new ConverterException(e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
我需要传递一个字符串值,而不是 Mono,当我传递 Mono 时,答案为空。
当我尝试从 Mono 获取字符串值时,出现此错误:
{
"timestamp": "2018-11-13T03:29:02.161+0000",
"path": "/v1/convert",
"status": 500,
"error": "Internal …Run Code Online (Sandbox Code Playgroud)