小编jny*_*jny的帖子

使用带有swagger ui的@RequestParam注释方法

我正在使用Springfox库来生成REST服务的文档,并在Swagger UI中显示它.我按照Springfox文档中的说明进行操作.

我有一个控制器,它使用查询字符串中的参数,方法映射如下:

@ApiOperation(value = "")
@RequestMapping(method = GET, value = "/customcollection/{id}/data")
public Iterable<CustomeType> getData(@ApiParam(value = "The identifier of the time series.") 
    @PathVariable String id,
    @ApiParam(name = "startDate", value = "start date", defaultValue = "")
    @RequestParam("startDate") String startDate,
    @ApiParam(name = "endDate", value = "end date", defaultValue = "")
    @RequestParam("endDate") String endDate)
Run Code Online (Sandbox Code Playgroud)

swagger-ui中生成的映射器显示为:

GET /customcollection/{id}/data{?startDate,endDate}
Run Code Online (Sandbox Code Playgroud)

参数在UI中正确显示: 在此输入图像描述

但是当我点击Try it Out时,请求URL会被误认为:

http:// localhost:8080/customcollection/1/data {?startDate,endDate}?startDate = 1&endDate = 2

怎么修好?

swagger-ui spring-boot swagger-2.0 springfox

24
推荐指数
1
解决办法
2万
查看次数

AXIS vs JAX-WS for Web Service Client

我决定用Java实现Web Service Client.我在Eclipse中生成了Axis客户端,在wsimport中生成了JAS-WS客户端.这两种解决方案都有效,现在我必须选择一种解决方案.在选择一个之前我应该​​考虑什么?

java axis soap wsdl jax-ws

10
推荐指数
2
解决办法
1万
查看次数

如何使用cassandra Stress工具

我想了解更多有关cassandra压力工具的知识,比如我如何进行压力测试和研究结果.当从cmd执行cassandra-stress时,在哪里创建了键空间,如何查看它们?

stress-testing cassandra-2.0 cassandra-stress

9
推荐指数
1
解决办法
1万
查看次数

DynamoDb batchGetItem 和分区键和排序键

我尝试使用batchGetItem从表中返回多个项目的属性,但似乎它仅适用于分区键和范围键的组合,但是如果我只想通过主键识别请求的项目怎么办?唯一的方法是创建没有范围键的表吗?

    // Adding items
    $client->putItem(array(
        'TableName' => $table,
        'Item' => array(
            'id'     => array('S' => '2a49ab04b1534574e578a08b8f9d7441'),
            'name'   => array('S' => 'test1'),
            'user_name'   => array('S' => 'aaa.bbb')
        )
    ));

    // Adding items
    $client->putItem(array(
        'TableName' => $table,
        'Item' => array(
            'id'     => array('S' => '4fd70b72cc21fab4f745a6073326234d'),
            'name'   => array('S' => 'test2'),
            'user_name'   => array('S' => 'aaaa.bbbb'),
            'user_name1'   => array('S' => 'aaaaa.bbbbb')
        )
    ));

$client->batchGetItem(array(
    "RequestItems" => array(
        $table => array(
            "Keys" => array(
                // hash key
                array(
                    "id"  => array( 'S' …
Run Code Online (Sandbox Code Playgroud)

php amazon-web-services amazon-dynamodb

7
推荐指数
1
解决办法
7773
查看次数

使用Spring Boot和JPA时如何保持

我习惯使用Spring Roo来生成我的实体,让它通过AspectJ类处理实体管理以及持久化和其他方法.现在我正在尝试使用Spring Boot做一些简单的事情,将事情写入数据库......

@Entity
@Table(name = "account")
public class Account { 

  transient EntityManager entityManager;

  @Id
  @GeneratedValue
  private Long id;

  @Column(name = "username", nullable = false, unique = true)
  private String username;

  @Column(name = "password", nullable = false)
  private String password;

  ... getters and setters

  @Transactional
  public void persist() {
    if (this.entityManager == null) this.entityManager = entityManager();
    this.entityManager.persist(this);
  }

  @Transactional
  public Account merge() {
    if (this.entityManager == null) this.entityManager = entityManager();
    Account merged = this.entityManager.merge(this);
    this.entityManager.flush();
    return merged;
  }
Run Code Online (Sandbox Code Playgroud)

当我调用persist或merge时,entityManager显然是null.

我也尝试添加 …

java spring jpa spring-data spring-boot

6
推荐指数
1
解决办法
2万
查看次数

Cassandra的压力测试

我正在使用DataStax Enterprise中cassandra中提供的压力测试.如果有人知道的话,我想得到一些关于它和cassandra的信息. - 首先,压力测试使用哪些节点?我的意思是,当我使用命令时(在由2个节点组成的环上):

./cassandra-stress -d ip1 --rerelication-factor 1

这意味着测试只使用第一个节点完全排除第二个节点?

  • 其次,当我保存一个键空间并在其中创建一些数据时(例如列族"cf1"和kespace"ks1"),文件夹/ var/lib/cassandra/data/ks1/cf1为空......这是正常的?当我连接到cassandra-cli时,它似乎从/.cassandra/assumpiont文件中读取.

  • 第三,是否可以从cassandra设置一个入口点?我的意思是强制只有一个节点来管理散列映射到所有其他节点的微积分.

cassandra cassandra-stress

5
推荐指数
1
解决办法
1881
查看次数

cassandra-stress"无法通过JMX连接;无法收集这些统计信息"

我今天第一次尝试使用cassandra-stress工具.虽然我能够运行该工具,但输出中会显示很多" 无法通过JMX连接;未收集这些统计信息 "消息

命令

cassandra-stress user \
    profile=./stress_write.yaml ops\(insert=1\) \
    n=1000000 \
    -log file=./stress_write.log \
    -node node1,node2,node3,node4,node5,node6
Run Code Online (Sandbox Code Playgroud)

产量

WARN  19:44:25 Found host with 0.0.0.0 as rpc_address, using listen_address (/node5) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.
WARN  19:44:25 Found host with 0.0.0.0 as rpc_address, using listen_address (/node1) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.
WARN  19:44:25 Found host with 0.0.0.0 …
Run Code Online (Sandbox Code Playgroud)

cassandra datastax-enterprise cassandra-stress

5
推荐指数
1
解决办法
3407
查看次数

Sonarqube:查看覆盖源的单元测试

我们在Bamboo中有一个CI设置,它运行Junit测试并使用Jacoco计算单元测试覆盖率.然后我们运行Sonar插件进行源代码分析.一切都很好,我们可以看到SonarCube服务器上的分析,包括覆盖范围,但我们希望确切地看到哪些测试覆盖了某些代码行.现在它只是说:由单元测试覆盖.

有没有办法做到这一点?

java junit bamboo jacoco sonarqube

5
推荐指数
1
解决办法
1135
查看次数

ConversionFailedException:持久化DBObject但检索返回LinkedHashMap <?,?>

我坚持一个对象:

@Document
public class PotentialCandidates {

    @Id
    private String jobid;

    @CreatedDate
    private DateTime created;

    @LastModifiedDate
    private DateTime modified;

    private DBObject potentialcandidates;

    public String getJobid() {
        return this.jobid;
    }   
    public void setJobid(String jobid) {
        this.jobid = jobid;
    }

    public DBObject getPotentialcandidates() {
        return this.potentialcandidates;
    }   
    public void setPotentialcandidates(DBObject potentialcandidates) {
        this.potentialcandidates = potentialcandidates;
    }

}
Run Code Online (Sandbox Code Playgroud)

其中,potentialCandidates从一个JSON字符串作为这样设置:

potentialCandidatesObj.setPotentialcandidates((DBObject)JSON.parse(valStr));
Run Code Online (Sandbox Code Playgroud)

这对我的mongodb很好,并且在我可以向下钻取的DB上给我一个对象,但是当我尝试检索我的db对象时:

    public PotentialCandidates getPotentialCandidatesByJobid(String jobid) throws NoSuchPotentialCandidatesException , SystemException{

    PotentialCandidates Jobid = null;
try {
            Query query = new Query();
            query.addCriteria(Criteria.where("_id").is(jobid));
            Jobid …
Run Code Online (Sandbox Code Playgroud)

java jdbc mongodb

3
推荐指数
1
解决办法
1099
查看次数

如何获取上传视频文件的缩略图?

几天来我一直在尝试为上传的文件创建缩略图,但没有成功。我尝试过 Xuggler、FFMpegFrameGrabber 和其他一些随机代码,但似乎都不起作用。从视频中捕获单个帧应该是一项微不足道的任务。有人知道我该怎么做吗?

java video thumbnails

3
推荐指数
1
解决办法
1万
查看次数

Spring boot 拦截器中的应用程序属性值

任何人都可以帮我读取 Spring Boot 拦截器(preHandle方法)中的应用程序属性值吗?

我正在尝试在preHandle. 这个逻辑需要从application.properties文件中获取一些值。我使用@Value注释,但它始终为空。

谢谢

spring interceptor spring-boot

3
推荐指数
2
解决办法
5215
查看次数

当CuratorFramework的方法开始和关闭时应该调用?

根据文件

CuratorFramework实例是完全线程安全的.您应该在应用程序中为每个ZooKeeper集群共享一个CuratorFramework.

它还声明应该在执行任何其他操作之前调用方法start.是应该在每次操作之前调用此方法,还是在初始化后调用一次就够了?

java apache-zookeeper apache-curator

1
推荐指数
1
解决办法
4120
查看次数