我正在使用Spring MVC(通过Spring Boot)并使用swagger-spring-mvc库集成了Swagger API文档.
我有一个看起来像这样的类:
@ApiModel
public class CartItem {
...
private Money listPrice; // joda money class
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(required = true, dataType = "java.lang.String")
public Money getListPrice() {
return listPrice;
}
...
}
Run Code Online (Sandbox Code Playgroud)
由于我在这个字段中使用ToStringSerializer,它在JSON中返回listPrice.toString,换句话说:
{
"listPrice": "USD 10.50"
}
Run Code Online (Sandbox Code Playgroud)
但是,swagger文档并没有遵守dataType ="java.lang.String".它将响应模型显示为:
"CartItem": {
"description": "",
"id": "CartItem",
"properties": {
"listPrice": {
"required": false,
"type": "Money"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试将@ApiModelProperty注释放在字段和方法上,并且在这两种情况下都遵循该required字段,但是该dataType字段被忽略.我也尝试使用"String","string"和"java.lang.String"作为dataType,但没有一个有效.
我错过了什么,或者这只是swagger-spring-mvc库中的一个错误?
我试图在亚马逊实例上安装jq JSON解析器,不幸的是,我无法安装它可以有人指导我.
我将redis配置为master,有两个slave,每个都在一个单独的盒子上.我还在每个盒子上运行了一个哨兵进程.它是这里的文档中描述的设置:
http://redis.io/topics/sentinel#example-2-basic-setup-with-three-boxes
每个哨兵都可以连接到我的主人,可以看到奴隶.他们能够独立检测主设备或从设备是否发生故障.问题是哨兵无法互相发现.
我已经验证了每个哨兵都__sentinel__:hello按预期向频道发布消息,但似乎没有一个实际上是从其他节目接收消息.
我如何让哨兵看到对方?
我正在尝试创建一个接收数组然后以相反方式返回该数组的方法.我写的代码反过来返回数组,但是,前两个值现在为0.任何人都知道我做错了什么?
public static int[] reverse(int[] x)
{
int []d = new int[x.length];
for (int i = 0; i < x.length/2; i++) // for loop, that checks each array slot
{
d[i] = x[i];
x[i] = x[x.length-1-i]; // creates a new array that is in reverse order of the original
x[x.length-1-i] = d[i];
}
return d; // returns the new reversed array
}
Run Code Online (Sandbox Code Playgroud)