我有一个这样的架构:
{
"type" : "object",
"$schema" : "http://json-schema.org/draft-03/schema#",
"id" : "urn:jsonschema:com:vlashel:dto:UserDto",
"description" : "this is the top description",
"title" : "this is the top title",
"properties" : {
"number" : {
"type" : "integer"
"required" : true
},
"password" : {
"type" : "string"
"required" : true
}
}
Run Code Online (Sandbox Code Playgroud)
我有以下代码通过删除“ required”将该shcema draft 3转换为草案4,我想收集其中具有“ requed”的节点属性名称。我怎么做?我看不到这种方法。
JsonNode jsonNode = jsonNodeIterator.next();
ObjectNode element;
if (jsonNode instanceof ObjectNode) {
element = (ObjectNode) jsonNode;
element.remove("required");
String propertyName = element.getPropertyName(); //I'm looking for this kind of …Run Code Online (Sandbox Code Playgroud) 我有一个使用休眠验证器进行验证的 Spring Web 应用程序。我有位于不同项目中的约束注释。我需要在我的 spring 项目中为这些约束设置验证器,因为我需要一些服务来执行验证。所以情况是:我不能将我的约束验证器放在 @Constraint(validatedBy = MyConstraintValidator.class) 中,因为验证器在不同的项目中,我不能添加依赖,因为这会创建循环依赖,这不是我们的方式想要它。我注意到 javax.constraints 没有指定验证器,它只是 @Constraint(validatedBy= {})。但是休眠验证器仍然知道如何验证它们。有没有办法告诉我的休眠验证器如何在不指定约束验证器的情况下验证我的约束?
我希望能够验证这个约束:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Constraint(validatedBy = {})
public @interface OneOf {
String message() default "{OneOf}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我在linux机器上的tomcat8中部署的java web应用程序一直在泄漏本机内存,我试图通过使用如下所述的jemalloc分析来检测泄漏源:https://github.com/jeffgriffith/native-jvm-泄漏 在运行> 24小时的服务器上使用堆转储输出分析工具:
Total: 794708494 B
789734456 99.4% 99.4% 789987533 99.4% JVM_FindSignal
3421211 0.4% 99.8% 3421211 0.4% Java_java_util_zip_ZipFile_getZipMessage
1036965 0.1% 99.9% 1036965 0.1% inflateBackEnd
262784 0.0% 100.0% 262784 0.0% __GI__dl_allocate_tls
253077 0.0% 100.0% 598675182 75.3% SUNWprivate_1.1
0 0.0% 100.0% 938397 0.1% 0x00007fb133688ef8
0 0.0% 100.0% 131136 0.0% 0x00007fb133696c2e
0 0.0% 100.0% 6146839 0.8% 0x00007fb13369b553
0 0.0% 100.0% 135210 0.0% 0x00007fb1336a63f5
0 0.0% 100.0% 131136 0.0% 0x00007fb1336a6403
0 0.0% 100.0% 266290 0.0% 0x00007fb1336a7819
0 0.0% 100.0% 296275 …Run Code Online (Sandbox Code Playgroud)