本文整理汇总了Java中io.github.jhipster.config.JHipsterProperties类的典型用法代码示例。如果您正苦于以下问题:Java JHipsterProperties类的具体用法?Java JHipsterProperties怎么用?Java JHipsterProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JHipsterProperties类属于io.github.jhipster.config包,在下文中一共展示了JHipsterProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hazelcastInstance
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
log.debug("Configuring Hazelcast");
HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("balance");
if (hazelCastInstance != null) {
log.debug("Hazelcast already initialized");
return hazelCastInstance;
}
Config config = new Config();
config.setInstanceName("balance");
config.getNetworkConfig().setPort(5701);
config.getNetworkConfig().setPortAutoIncrement(true);
// In development, remove multicast auto-configuration
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
System.setProperty("hazelcast.local.localAddress", "127.0.0.1");
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
}
config.getMapConfigs().put("default", initializeDefaultMapConfig());
config.getMapConfigs().put("com.icthh.xm.ms.balance.domain.*", initializeDomainMapConfig(jHipsterProperties));
return Hazelcast.newHazelcastInstance(config);
}
示例2: setup
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
String mockProfile[] = {"test"};
JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
ribbon.setDisplayOnActiveProfiles(mockProfile);
when(jHipsterProperties.getRibbon()).thenReturn(ribbon);
String activeProfiles[] = {"test"};
when(environment.getDefaultProfiles()).thenReturn(activeProfiles);
when(environment.getActiveProfiles()).thenReturn(activeProfiles);
ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
this.restProfileMockMvc = MockMvcBuilders
.standaloneSetup(profileInfoResource)
.build();
}
示例3: customize
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", "text/html;charset=utf-8");
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
// When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
setLocationForStaticAssets(container);
/*
* Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
* HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
* See the JHipsterProperties class and your application-*.yml configuration files
* for more information.
*/
if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
container instanceof UndertowEmbeddedServletContainerFactory) {
((UndertowEmbeddedServletContainerFactory) container)
.addBuilderCustomizers(builder ->
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
}
}
示例4: customize
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", "text/html;charset=utf-8");
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
/*
* Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
* HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
* See the JHipsterProperties class and your application-*.yml configuration files
* for more information.
*/
if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
container instanceof UndertowEmbeddedServletContainerFactory) {
((UndertowEmbeddedServletContainerFactory) container)
.addBuilderCustomizers(builder ->
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
}
}
示例5: setup
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
String mockProfile[] = { "test" };
JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
ribbon.setDisplayOnActiveProfiles(mockProfile);
when(jHipsterProperties.getRibbon()).thenReturn(ribbon);
String activeProfiles[] = {"test"};
when(environment.getDefaultProfiles()).thenReturn(activeProfiles);
when(environment.getActiveProfiles()).thenReturn(activeProfiles);
ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
this.restProfileMockMvc = MockMvcBuilders
.standaloneSetup(profileInfoResource)
.build();
}
示例6: hazelcastInstance
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Bean
@Primary
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
log.debug("Configuring Hazelcast");
HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("gate");
if (hazelCastInstance != null) {
log.debug("Hazelcast already initialized");
return hazelCastInstance;
}
Config config = new Config();
config.setInstanceName("gate");
config.getNetworkConfig().setPort(5701);
config.getNetworkConfig().setPortAutoIncrement(true);
// In development, remove multicast auto-configuration
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
System.setProperty("hazelcast.local.localAddress", "127.0.0.1");
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
}
config.getMapConfigs().put("default", initializeDefaultMapConfig());
config.getMapConfigs().put("com.icthh.xm.gate.domain.*", initializeDomainMapConfig(jHipsterProperties));
return Hazelcast.newHazelcastInstance(config);
}
示例7: customize
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", "text/html;charset=utf-8");
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
// When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
setLocationForStaticAssets(container);
/*
* Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
* HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
* See the JHipsterProperties class and your application-*.yml configuration files
* for more information.
*/
if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
container instanceof UndertowEmbeddedServletContainerFactory) {
((UndertowEmbeddedServletContainerFactory) container)
.addBuilderCustomizers(builder ->
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
}
}
示例8: hazelcastInstance
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
log.debug("Configuring Hazelcast");
HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("uaa");
if (hazelCastInstance != null) {
log.debug("Hazelcast already initialized");
return hazelCastInstance;
}
Config config = new Config();
config.setInstanceName("uaa");
config.getNetworkConfig().setPort(5701);
config.getNetworkConfig().setPortAutoIncrement(true);
// In development, remove multicast auto-configuration
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
System.setProperty("hazelcast.local.localAddress", "127.0.0.1");
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
}
config.getMapConfigs().put("default", initializeDefaultMapConfig());
config.getMapConfigs().put("com.icthh.xm.uaa.domain.*", initializeDomainMapConfig(jHipsterProperties));
// Uncomment if session needed
//config.getMapConfigs().put("clustered-http-sessions", initializeClusteredSession(jHipsterProperties));
return Hazelcast.newHazelcastInstance(config);
}
示例9: CacheConfiguration
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
public CacheConfiguration(JHipsterProperties jHipsterProperties) {
JHipsterProperties.Cache.Ehcache ehcache =
jHipsterProperties.getCache().getEhcache();
jcacheConfiguration = Eh107Configuration.fromEhcacheCacheConfiguration(
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class,
ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
.withExpiry(Expirations.timeToLiveExpiration(Duration.of(ehcache.getTimeToLiveSeconds(), TimeUnit.SECONDS)))
.build());
}
示例10: LoggingConfiguration
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
JHipsterProperties jHipsterProperties) {
this.appName = appName;
this.serverPort = serverPort;
this.jHipsterProperties = jHipsterProperties;
if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
addLogstashAppender(context);
// Add context listener
LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
loggerContextListener.setContext(context);
context.addListener(loggerContextListener);
}
}
示例11: setup
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Before
public void setup() {
servletContext = spy(new MockServletContext());
doReturn(new MockFilterRegistration())
.when(servletContext).addFilter(anyString(), any(Filter.class));
doReturn(new MockServletRegistration())
.when(servletContext).addServlet(anyString(), any(Servlet.class));
env = new MockEnvironment();
props = new JHipsterProperties();
webConfigurer = new WebConfigurer(env, props, new MockHazelcastInstance());
metricRegistry = new MetricRegistry();
webConfigurer.setMetricRegistry(metricRegistry);
}
示例12: testUndertowHttp2Enabled
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
@Test
public void testUndertowHttp2Enabled() {
props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0);
UndertowEmbeddedServletContainerFactory container = new UndertowEmbeddedServletContainerFactory();
webConfigurer.customize(container);
Builder builder = Undertow.builder();
container.getBuilderCustomizers().forEach(c -> c.customize(builder));
OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions");
assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue();
}
示例13: getConfigSupplier
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
private Supplier<BucketConfiguration> getConfigSupplier() {
return () -> {
JHipsterProperties.Gateway.RateLimiting rateLimitingProperties =
jHipsterProperties.getGateway().getRateLimiting();
return Bucket4j.configurationBuilder()
.addLimit(Bandwidth.simple(rateLimitingProperties.getLimit(),
Duration.ofSeconds(rateLimitingProperties.getDurationInSeconds())))
.buildConfiguration();
};
}
示例14: LoggingConfiguration
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
@Value("${eureka.instance.instanceId}") String instanceId, JHipsterProperties jHipsterProperties) {
this.appName = appName;
this.serverPort = serverPort;
this.instanceId = instanceId;
this.jHipsterProperties = jHipsterProperties;
if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
addLogstashAppender(context);
// Add context listener
LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
loggerContextListener.setContext(context);
context.addListener(loggerContextListener);
}
}
示例15: LoggingConfiguration
import io.github.jhipster.config.JHipsterProperties; //导入依赖的package包/类
public LoggingConfiguration(@Value("${spring.application.name}") String appName, @Value("${server.port}") String serverPort,
JHipsterProperties jHipsterProperties) {
this.appName = appName;
this.serverPort = serverPort;
this.jHipsterProperties = jHipsterProperties;
if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
addLogstashAppender(context);
addContextListener(context);
}
if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
setMetricsMarkerLogbackFilter(context);
}
}