All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.jhipster.config.JHipsterProperties Maven / Gradle / Ivy

Go to download

Server-side library used by applications created with the JHipster generator, see https://www.jhipster.tech/ for more information on JHipster

There is a newer version: 3.9.1
Show newest version
/*
 * Copyright 2016-2020 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.github.jhipster.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.web.cors.CorsConfiguration;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * Properties specific to JHipster.
 *
 * 

Properties are configured in the application.yml file.

*

This class also load properties in the Spring Environment from the git.properties and META-INF/build-info.properties * files if they are found in the classpath.

*/ @ConfigurationProperties(prefix = "jhipster", ignoreUnknownFields = false) @PropertySources({ @PropertySource(value = "classpath:git.properties", ignoreResourceNotFound = true), @PropertySource(value = "classpath:META-INF/build-info.properties", ignoreResourceNotFound = true) }) public class JHipsterProperties { private final Async async = new Async(); private final Http http = new Http(); 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(); private final Logging logging = new Logging(); private final CorsConfiguration cors = new CorsConfiguration(); private final Social social = new Social(); private final Gateway gateway = new Gateway(); private final Registry registry = new Registry(); private final ClientApp clientApp = new ClientApp(); private final AuditEvents auditEvents = new AuditEvents(); /** *

Getter for the field async.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Async} object. */ public Async getAsync() { return async; } /** *

Getter for the field http.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Http} object. */ public Http getHttp() { return http; } /** *

Getter for the field cache.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Cache} object. */ public Cache getCache() { return cache; } /** *

Getter for the field mail.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Mail} object. */ public Mail getMail() { return mail; } /** *

Getter for the field registry.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Registry} object. */ public Registry getRegistry() { return registry; } /** *

Getter for the field security.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Security} object. */ public Security getSecurity() { return security; } /** *

Getter for the field swagger.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Swagger} object. */ public Swagger getSwagger() { return swagger; } /** *

Getter for the field metrics.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Metrics} object. */ public Metrics getMetrics() { return metrics; } /** *

Getter for the field logging.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Logging} object. */ public Logging getLogging() { return logging; } /** *

Getter for the field cors.

* * @return a {@link org.springframework.web.cors.CorsConfiguration} object. */ public CorsConfiguration getCors() { return cors; } /** *

Getter for the field social.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Social} object. */ public Social getSocial() { return social; } /** *

Getter for the field gateway.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.Gateway} object. */ public Gateway getGateway() { return gateway; } /** *

Getter for the field clientApp.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.ClientApp} object. */ public ClientApp getClientApp() { return clientApp; } /** *

Getter for the field auditEvents.

* * @return a {@link io.github.jhipster.config.JHipsterProperties.AuditEvents} object. */ public AuditEvents getAuditEvents() { return auditEvents; } public static class Async { private int corePoolSize = JHipsterDefaults.Async.corePoolSize; private int maxPoolSize = JHipsterDefaults.Async.maxPoolSize; private int queueCapacity = JHipsterDefaults.Async.queueCapacity; 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 = JHipsterDefaults.Http.Cache.timeToLiveInDays; public int getTimeToLiveInDays() { return timeToLiveInDays; } public void setTimeToLiveInDays(int timeToLiveInDays) { this.timeToLiveInDays = timeToLiveInDays; } } } public static class Cache { private final Hazelcast hazelcast = new Hazelcast(); private final Caffeine caffeine = new Caffeine(); private final Ehcache ehcache = new Ehcache(); private final Infinispan infinispan = new Infinispan(); private final Memcached memcached = new Memcached(); private final Redis redis = new Redis(); public Hazelcast getHazelcast() { return hazelcast; } public Caffeine getCaffeine() { return caffeine; } public Ehcache getEhcache() { return ehcache; } public Infinispan getInfinispan() { return infinispan; } public Memcached getMemcached() { return memcached; } public Redis getRedis() { return redis; } public static class Hazelcast { private int timeToLiveSeconds = JHipsterDefaults.Cache.Hazelcast.timeToLiveSeconds; private int backupCount = JHipsterDefaults.Cache.Hazelcast.backupCount; private final ManagementCenter managementCenter = new ManagementCenter(); public ManagementCenter getManagementCenter() { return managementCenter; } public static class ManagementCenter { private boolean enabled = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.enabled; private int updateInterval = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.updateInterval; private String url = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.url; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public int getUpdateInterval() { return updateInterval; } public void setUpdateInterval(int updateInterval) { this.updateInterval = updateInterval; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } public int getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(int timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public int getBackupCount() { return backupCount; } public void setBackupCount(int backupCount) { this.backupCount = backupCount; } } public static class Caffeine { private int timeToLiveSeconds = JHipsterDefaults.Cache.Caffeine.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Caffeine.maxEntries; public int getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(int timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } public static class Ehcache { private int timeToLiveSeconds = JHipsterDefaults.Cache.Ehcache.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Ehcache.maxEntries; public int getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(int timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } public static class Infinispan { private String configFile = JHipsterDefaults.Cache.Infinispan.configFile; private boolean statsEnabled = JHipsterDefaults.Cache.Infinispan.statsEnabled; private final Local local = new Local(); private final Distributed distributed = new Distributed(); private final Replicated replicated = new Replicated(); public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public boolean isStatsEnabled() { return statsEnabled; } public void setStatsEnabled(boolean statsEnabled) { this.statsEnabled = statsEnabled; } public Local getLocal() { return local; } public Distributed getDistributed() { return distributed; } public Replicated getReplicated() { return replicated; } public static class Local { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Local.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Local.maxEntries; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } public static class Distributed { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Distributed.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Distributed.maxEntries; private int instanceCount = JHipsterDefaults.Cache.Infinispan.Distributed.instanceCount; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } public int getInstanceCount() { return instanceCount; } public void setInstanceCount(int instanceCount) { this.instanceCount = instanceCount; } } public static class Replicated { private long timeToLiveSeconds = JHipsterDefaults.Cache.Infinispan.Replicated.timeToLiveSeconds; private long maxEntries = JHipsterDefaults.Cache.Infinispan.Replicated.maxEntries; public long getTimeToLiveSeconds() { return timeToLiveSeconds; } public void setTimeToLiveSeconds(long timeToLiveSeconds) { this.timeToLiveSeconds = timeToLiveSeconds; } public long getMaxEntries() { return maxEntries; } public void setMaxEntries(long maxEntries) { this.maxEntries = maxEntries; } } } public static class Memcached { private boolean enabled = JHipsterDefaults.Cache.Memcached.enabled; /** * Comma or whitespace separated list of servers' addresses. */ private String servers = JHipsterDefaults.Cache.Memcached.servers; private int expiration = JHipsterDefaults.Cache.Memcached.expiration; private boolean useBinaryProtocol = JHipsterDefaults.Cache.Memcached.useBinaryProtocol; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getServers() { return servers; } public void setServers(String servers) { this.servers = servers; } public int getExpiration() { return expiration; } public void setExpiration(int expiration) { this.expiration = expiration; } public boolean isUseBinaryProtocol() { return useBinaryProtocol; } public void setUseBinaryProtocol(boolean useBinaryProtocol) { this.useBinaryProtocol = useBinaryProtocol; } } public static class Redis { private String[] server = JHipsterDefaults.Cache.Redis.server; private int expiration = JHipsterDefaults.Cache.Redis.expiration; private boolean cluster = JHipsterDefaults.Cache.Redis.cluster; public String[] getServer() { return server; } public void setServer(String[] server) { this.server = server; } public int getExpiration() { return expiration; } public void setExpiration(int expiration) { this.expiration = expiration; } public boolean isCluster() { return cluster; } public void setCluster(boolean cluster) { this.cluster = cluster; } } } public static class Mail { private boolean enabled = JHipsterDefaults.Mail.enabled; private String from = JHipsterDefaults.Mail.from; private String baseUrl = JHipsterDefaults.Mail.baseUrl; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getBaseUrl() { return baseUrl; } public void setBaseUrl(String baseUrl) { this.baseUrl = baseUrl; } } public static class Security { private final ClientAuthorization clientAuthorization = new ClientAuthorization(); private final Authentication authentication = new Authentication(); private final RememberMe rememberMe = new RememberMe(); private final OAuth2 oauth2 = new OAuth2(); public ClientAuthorization getClientAuthorization() { return clientAuthorization; } public Authentication getAuthentication() { return authentication; } public RememberMe getRememberMe() { return rememberMe; } public OAuth2 getOauth2() { return oauth2; } public static class ClientAuthorization { private String accessTokenUri = JHipsterDefaults.Security.ClientAuthorization.accessTokenUri; private String tokenServiceId = JHipsterDefaults.Security.ClientAuthorization.tokenServiceId; private String clientId = JHipsterDefaults.Security.ClientAuthorization.clientId; private String clientSecret = JHipsterDefaults.Security.ClientAuthorization.clientSecret; public String getAccessTokenUri() { return accessTokenUri; } public void setAccessTokenUri(String accessTokenUri) { this.accessTokenUri = accessTokenUri; } public String getTokenServiceId() { return tokenServiceId; } public void setTokenServiceId(String tokenServiceId) { this.tokenServiceId = tokenServiceId; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } public String getClientSecret() { return clientSecret; } public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } } public static class Authentication { private final Jwt jwt = new Jwt(); public Jwt getJwt() { return jwt; } public static class Jwt { private String secret = JHipsterDefaults.Security.Authentication.Jwt.secret; private String base64Secret = JHipsterDefaults.Security.Authentication.Jwt.base64Secret; private long tokenValidityInSeconds = JHipsterDefaults.Security.Authentication.Jwt .tokenValidityInSeconds; private long tokenValidityInSecondsForRememberMe = JHipsterDefaults.Security.Authentication.Jwt .tokenValidityInSecondsForRememberMe; public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getBase64Secret() { return base64Secret; } public void setBase64Secret(String base64Secret) { this.base64Secret = base64Secret; } public long getTokenValidityInSeconds() { return tokenValidityInSeconds; } public void setTokenValidityInSeconds(long tokenValidityInSeconds) { this.tokenValidityInSeconds = tokenValidityInSeconds; } public long getTokenValidityInSecondsForRememberMe() { return tokenValidityInSecondsForRememberMe; } public void setTokenValidityInSecondsForRememberMe(long tokenValidityInSecondsForRememberMe) { this.tokenValidityInSecondsForRememberMe = tokenValidityInSecondsForRememberMe; } } } public static class RememberMe { @NotNull private String key = JHipsterDefaults.Security.RememberMe.key; public String getKey() { return key; } public void setKey(String key) { this.key = key; } } public static class OAuth2 { private List audience = new ArrayList<>(); public List getAudience() { return Collections.unmodifiableList(audience); } public void setAudience(@NotNull List audience) { this.audience.addAll(audience); } } } public static class Swagger { private String title = JHipsterDefaults.Swagger.title; private String description = JHipsterDefaults.Swagger.description; private String version = JHipsterDefaults.Swagger.version; private String termsOfServiceUrl = JHipsterDefaults.Swagger.termsOfServiceUrl; private String contactName = JHipsterDefaults.Swagger.contactName; private String contactUrl = JHipsterDefaults.Swagger.contactUrl; private String contactEmail = JHipsterDefaults.Swagger.contactEmail; private String license = JHipsterDefaults.Swagger.license; private String licenseUrl = JHipsterDefaults.Swagger.licenseUrl; private String defaultIncludePattern = JHipsterDefaults.Swagger.defaultIncludePattern; private String host = JHipsterDefaults.Swagger.host; private String[] protocols = JHipsterDefaults.Swagger.protocols; private boolean useDefaultResponseMessages = JHipsterDefaults.Swagger.useDefaultResponseMessages; 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 getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public String getContactUrl() { return contactUrl; } public void setContactUrl(String contactUrl) { this.contactUrl = contactUrl; } public String getContactEmail() { return contactEmail; } public void setContactEmail(String contactEmail) { this.contactEmail = contactEmail; } 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 String getDefaultIncludePattern() { return defaultIncludePattern; } public void setDefaultIncludePattern(String defaultIncludePattern) { this.defaultIncludePattern = defaultIncludePattern; } public String getHost() { return host; } public void setHost(final String host) { this.host = host; } public String[] getProtocols() { return protocols; } public void setProtocols(final String[] protocols) { this.protocols = protocols; } public boolean isUseDefaultResponseMessages() { return useDefaultResponseMessages; } public void setUseDefaultResponseMessages(final boolean useDefaultResponseMessages) { this.useDefaultResponseMessages = useDefaultResponseMessages; } } public static class Metrics { private final Logs logs = new Logs(); public Logs getLogs() { return logs; } public static class Logs { private boolean enabled = JHipsterDefaults.Metrics.Logs.enabled; private long reportFrequency = JHipsterDefaults.Metrics.Logs.reportFrequency; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public long getReportFrequency() { return reportFrequency; } public void setReportFrequency(long reportFrequency) { this.reportFrequency = reportFrequency; } } } public static class Logging { private boolean useJsonFormat = JHipsterDefaults.Logging.useJsonFormat; private final Logstash logstash = new Logstash(); public boolean isUseJsonFormat() { return useJsonFormat; } public void setUseJsonFormat(boolean useJsonFormat) { this.useJsonFormat = useJsonFormat; } public Logstash getLogstash() { return logstash; } public static class Logstash { private boolean enabled = JHipsterDefaults.Logging.Logstash.enabled; private String host = JHipsterDefaults.Logging.Logstash.host; private int port = JHipsterDefaults.Logging.Logstash.port; private int queueSize = JHipsterDefaults.Logging.Logstash.queueSize; 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 int getQueueSize() { return queueSize; } public void setQueueSize(int queueSize) { this.queueSize = queueSize; } } } public static class Social { private String redirectAfterSignIn = JHipsterDefaults.Social.redirectAfterSignIn; public String getRedirectAfterSignIn() { return redirectAfterSignIn; } public void setRedirectAfterSignIn(String redirectAfterSignIn) { this.redirectAfterSignIn = redirectAfterSignIn; } } public static class Gateway { private final RateLimiting rateLimiting = new RateLimiting(); public RateLimiting getRateLimiting() { return rateLimiting; } private Map> authorizedMicroservicesEndpoints = JHipsterDefaults.Gateway .authorizedMicroservicesEndpoints; public Map> getAuthorizedMicroservicesEndpoints() { return authorizedMicroservicesEndpoints; } public void setAuthorizedMicroservicesEndpoints(Map> authorizedMicroservicesEndpoints) { this.authorizedMicroservicesEndpoints = authorizedMicroservicesEndpoints; } public static class RateLimiting { private boolean enabled = JHipsterDefaults.Gateway.RateLimiting.enabled; private long limit = JHipsterDefaults.Gateway.RateLimiting.limit; private int durationInSeconds = JHipsterDefaults.Gateway.RateLimiting.durationInSeconds; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public long getLimit() { return this.limit; } public void setLimit(long limit) { this.limit = limit; } public int getDurationInSeconds() { return durationInSeconds; } public void setDurationInSeconds(int durationInSeconds) { this.durationInSeconds = durationInSeconds; } } } public static class Registry { private String password = JHipsterDefaults.Registry.password; public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } public static class ClientApp { private String name = JHipsterDefaults.ClientApp.name; public String getName() { return name; } public void setName(String name) { this.name = name; } } public static class AuditEvents { private int retentionPeriod = JHipsterDefaults.AuditEvents.retentionPeriod; public int getRetentionPeriod() { return retentionPeriod; } public void setRetentionPeriod(int retentionPeriod) { this.retentionPeriod = retentionPeriod; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy