我需要从一些XML元素解码Base64字符串.定义type="xs:base64binary"的元素和由type="xs:string"?定义的元素之间是否有任何区别?一些XSD开发人员拒绝将编码的字符串标记为base64binary.如果没有区别,有什么用type="xs:base64binary"?
Spring Web 堆栈上有一个应用程序。升级到最新版本后,我遇到了一个不寻常的问题Spring Boot 2.6.1。
下面的代码
@RestController
@RequestMapping("sample")
class SampleController {
@PostMapping
fun doSomething(@RequestBody body: Any): Any {
error("Error!")
}
}
Run Code Online (Sandbox Code Playgroud)
用于在早期版本中产生以下错误
{
"timestamp": "2020-05-27T13:44:58.032+00:00",
"status": 500,
"error": "Internal Server Error",
"message": "Error!",
"path": "/sample"
}
Run Code Online (Sandbox Code Playgroud)
但升级后整个响应体是空的。不是message可以通过server.error.inclide-message: always标志设置来固定的字段,而是整个主体。该include-binding-errors: always标志也没有效果。
我在 Spring Boot 变更日志中没有发现有关该行为的注释
我有一个巨大的企业 Java 应用程序,其中包含“非常好的”技术堆栈:Spring Web MVC、PostgreSQL、MyBatis。我们假设确实需要将应用程序迁移到反应式堆栈。这意味着旧的 Postrges JDBC 驱动程序和 MyBatis 将不再适用,因为它们具有阻塞性质。这反过来意味着整个数据库层(MyBatis 映射器)必须使用 r2dbc 实现之一进行重构。这真的是一件大事!
所以问题是:是否有任何技巧可以使用现有的映射器以及反应式 Fluxes 和 Monos?也许有一些类似回调的解决方案或其他什么?
UPD
Mono有一个fromFuture方法。以下代码有效并且按预期工作。但它真的是通过它的精神来反应的吗?
public Mono<User> getUserById(Long id) {
return Mono.fromFuture(
CompletableFuture.supplyAsync(() -> userMapper.getUser(id)));
}
Run Code Online (Sandbox Code Playgroud) 我使用下面的代码从带注释的 java 类生成 XSD。XSD 的默认名称始终为“schema1.xsd”。我应该如何仅使用该插件来预定义它?目前我使用 maven-antrun-plugin 进行文件重命名。插件手册不包含相关信息。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>schemagen</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>src/main/java/***some package***</source>
</sources>
<outputDirectory>${project.build.directory}/generated-sources/schemas</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 供应商向我发送一个 json 模式。请看这个:
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"definitions" : {
...
},
"oneOf" : [{
"$ref" : "#/definitions/commons/strings/text"
}, {
"$ref" : "#/definitions/dto/scriptStep"
}, {
"$ref" : "#/definitions/dto/callResult"
}
]
}
Run Code Online (Sandbox Code Playgroud)
没有“属性”关键字(但顺便说一下,有非常大的“定义”部分)。这是否意味着架构实际上描述了空的 json 对象 {}?或者这是否意味着 json 可以包含“oneOf”数组中的元素之一?
java ×2
xsd ×2
base64 ×1
jaxb ×1
json ×1
jsonschema ×1
kotlin ×1
maven ×1
mybatis ×1
spring ×1
spring-boot ×1
spring-mvc ×1
xml ×1