package com.mycompany.myapp.config;
import javax.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Properties specific to JHipster.
*
* <p>
* Properties are configured in the application.yml file.
* </p>
*/
@ConfigurationProperties(prefix = "jhipster", ignoreUnknownFields = false)
public class JHipsterProperties {
private final Async async = new Async();
private final Http http = new Http();
private final Datasource datasource = new Datasource();
private final Cache cache = new Cache();
private final Mail mail = new Mail();
private final Security security = new Security();
private final Swagger swagger = new Swagger();
private final Metrics metrics = new Metrics();
public Async getAsync() {
return async;
}
public Http getHttp() {
return http;
}
public Datasource getDatasource() {
return datasource;
}
public Cache getCache() {
return cache;
}
public Mail getMail() {
return mail;
}
public Security getSecurity() {
return security;
}
public Swagger getSwagger() {
return swagger;
}
public Metrics getMetrics() {
return metrics;
}
public static class Async {
private int corePoolSize = 2;
private int maxPoolSize = 50;
private int queueCapacity = 10000;
public int getCorePoolSize() {
return corePoolSize;
}
public void setCorePoolSize(int corePoolSize) {
this.corePoolSize = corePoolSize;
}
public int getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
public int getQueueCapacity() {
return queueCapacity;
}
public void setQueueCapacity(int queueCapacity) {
this.queueCapacity = queueCapacity;
}
}
public static class Http {
private final Cache cache = new Cache();
public Cache getCache() {
return cache;
}
public static class Cache {
private int timeToLiveInDays = 31;
public int getTimeToLiveInDays() {
return timeToLiveInDays;
}
public void setTimeToLiveInDays(int timeToLiveInDays) {
this.timeToLiveInDays = timeToLiveInDays;
}
}
}
public static class Datasource {
private String serverName;
private boolean cachePrepStmts = true;
private int prepStmtCacheSize = 250;
private int prepStmtCacheSqlLimit = 2048;
private boolean useServerPrepStmts = true;
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
public boolean isCachePrepStmts() {
return cachePrepStmts;
}
public void setCachePrepStmts(boolean cachePrepStmts) {
this.cachePrepStmts = cachePrepStmts;
}
public int getPrepStmtCacheSize() {
return prepStmtCacheSize;
}
public void setPrepStmtCacheSize(int prepStmtCacheSize) {
this.prepStmtCacheSize = prepStmtCacheSize;
}
public int getPrepStmtCacheSqlLimit() {
return prepStmtCacheSqlLimit;
}
public void setPrepStmtCacheSqlLimit(int prepStmtCacheSqlLimit) {
this.prepStmtCacheSqlLimit = prepStmtCacheSqlLimit;
}
public boolean isUseServerPrepStmts() {
return useServerPrepStmts;
}
public void setUseServerPrepStmts(boolean useServerPrepStmts) {
this.useServerPrepStmts = useServerPrepStmts;
}
}
public static class Cache {
private int timeToLiveSeconds = 3600;
private final Ehcache ehcache = new Ehcache();
public int getTimeToLiveSeconds() {
return timeToLiveSeconds;
}
public void setTimeToLiveSeconds(int timeToLiveSeconds) {
this.timeToLiveSeconds = timeToLiveSeconds;
}
public Ehcache getEhcache() {
return ehcache;
}
public static class Ehcache {
private String maxBytesLocalHeap = "16M";
public String getMaxBytesLocalHeap() {
return maxBytesLocalHeap;
}
public void setMaxBytesLocalHeap(String maxBytesLocalHeap) {
this.maxBytesLocalHeap = maxBytesLocalHeap;
}
}
}
public static class Mail {
private String host = "localhost";
private int port = 25;
private String username;
private String password;
private String protocol = "smtp";
private boolean tls = false;
private boolean auth = false;
private String from = "sampleJava7@localhost";
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public boolean isTls() {
return tls;
}
public void setTls(boolean tls) {
this.tls = tls;
}
public boolean isAuth() {
return auth;
}
public void setAuth(boolean auth) {
this.auth = auth;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
}
public static class Security {
private final Rememberme rememberme = new Rememberme();
public Rememberme getRememberme() {
return rememberme;
}
public static class Rememberme {
@NotNull
private String key;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
public static class Swagger {
private String title = "sampleJava7 API";
private String description = "sampleJava7 API documentation";
private String version = "0.0.1";
private String termsOfServiceUrl;
private String contact;
private String license;
private String licenseUrl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getTermsOfServiceUrl() {
return termsOfServiceUrl;
}
public void setTermsOfServiceUrl(String termsOfServiceUrl) {
this.termsOfServiceUrl = termsOfServiceUrl;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public String getLicenseUrl() {
return licenseUrl;
}
public void setLicenseUrl(String licenseUrl) {
this.licenseUrl = licenseUrl;
}
}
public static class Metrics {
private final Jmx jmx = new Jmx();
private final Spark spark = new Spark();
private final Graphite graphite = new Graphite();
public Jmx getJmx() {
return jmx;
}
public Spark getSpark() {
return spark;
}
public Graphite getGraphite() {
return graphite;
}
public static class Jmx {
private boolean enabled = true;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
public static class Spark {
private boolean enabled = false;
private String host = "localhost";
private int port = 9999;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
public static class Graphite {
private boolean enabled = false;
private String host = "localhost";
private int port = 2003;
private String prefix = "sampleJava7";
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}
}
}