最近我将HVDF项目的dropwizard版本从0.6.2移植到0.8.2.一旦我尝试运行应用程序,我得到以下错误.我提供下面的配置类和yml文件:
配置类:
package com.mongodb.hvdf;
import io.dropwizard.Configuration;
import java.util.LinkedHashMap;
import java.util.Map;
import com.mongodb.hvdf.configuration.MongoGeneralConfiguration;
public class HVDFConfiguration extends Configuration {
public MongoGeneralConfiguration mongodb = new MongoGeneralConfiguration();
public Map<String, Object> services = new LinkedHashMap<String, Object>();
}
Run Code Online (Sandbox Code Playgroud)
Yaml文件:
server:
applicationConnectors:
- type: http
port: 8080
Run Code Online (Sandbox Code Playgroud)
我在运行时收到以下错误:
config.yml has an error:
* Failed to parse configuration at: server.applicationConnectors.[0]; Could not resolve type id 'http' into a subtype of [simple type, class io.dropwizard.jetty.ConnectorFactory]
at [Source: N/A; line: -1, column: -1] (through reference chain: com.mongodb.hvdf.HVDFConfiguration["server"]->io.dropwizard.server.DefaultServerFactory["applicationConnectors"]->java.util.ArrayList[0])
Run Code Online (Sandbox Code Playgroud) 我想向用户显示图像并获取用户点击的图像像素或点击图像的坐标.实际上我想在指定坐标处的那个图像上放一个点并将其保存在磁盘上.
此代码有效:
TcpClient tcpClient = (TcpClient)client;
NetworkStream clientStream = tcpClient.GetStream();
byte[] message = new byte[5242880];
int bytesRead;
bytesRead = clientStream.Read(message, 0, 909699);
Run Code Online (Sandbox Code Playgroud)
但是这会返回错误的字节数:
bytesRead = clientStream.Read(message, 0, 5242880);
Run Code Online (Sandbox Code Playgroud)
为什么?我该如何解决?
(实际数据大小为1475186;代码返回11043作为字节数)
我需要知道在java中是否可以进行这种构造函数链调用?我正在扩展基础JButton类,我首先需要初始化超级变量,然后使用默认构造函数初始化我的类.
public CustomButton(){
try {
URL inp = CustomButton.class.getResource("/icons/noa_en/buttonBackground.png");
background = ImageIO.read(inp);
} catch (IOException e) {
e.printStackTrace();
}
}
public CustomButton(ImageIcon img){
super(img);
this();
}
Run Code Online (Sandbox Code Playgroud)
要么 :
public CustomButton(ImageIcon img){
this();
super(img);
}
Run Code Online (Sandbox Code Playgroud) 我知道如何绘制圆角矩形,但我想分别为每个角定义圆度,并绘制如下图所示的内容:

java ×3
c# ×2
awt ×1
click ×1
constructor ×1
coordinates ×1
drawing ×1
dropwizard ×1
image ×1
java-2d ×1
networking ×1
swing ×1
wpf ×1
yaml ×1