每个Dropwizard应用都有一个对应配置类,用于指定特定的环境参数。这个配置类扩展自 io.dropwizard.Configuration类,应用启动时,系统将从YAML配置文件反序列化读取对应的参数。如下
package com.jsq.hibernate.config;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class HelloWorldConfiguration extends Configuration {
private String template;
private String defaultName = "Stranger";
private DataSourceFactory database = new DataSourceFactory();
@JsonProperty("database")
public DataSourceFactory getDataSourceFactory() {
return database;
}
}
jersey使用文档s:https://eclipse-ee4j.github.io/jersey/
Jersey的标准用法,注册绑定资源类 按类进行注册:environment.jersey().register(new UiframeResource ()); 按资源包进行注册:environment.jersey().packages(API_RESOURCE);
https://dropwizard.github.io/dropwizard/0.8.0/docs/getting-started.html