public RocketChatEndpoint(
@Value("${rocketchat.proxy.hostname:}") String proxyHostname,
@Value("${rocketchat.proxy.port:80}") int proxyPort,
@Value("${rocketchat.proxy.scheme:http}") String proxyScheme
) {
httpClientBuilder = HttpClientBuilder.create()
.setRetryHandler((exception, executionCount, context) -> executionCount < 3)
.setConnectionBackoffStrategy(new ConnectionBackoffStrategy() {
@Override
public boolean shouldBackoff(Throwable t) {
return t instanceof IOException;
}
@Override
public boolean shouldBackoff(HttpResponse resp) {
return false;
}
})
.setUserAgent("Smarti/0.0 Rocket.Chat-Endpoint/0.1");
if(StringUtils.isNotBlank(proxyHostname)) {
httpClientBuilder.setProxy(new HttpHost(proxyHostname, proxyPort, proxyScheme));
}
}
java类org.springframework.beans.factory.annotation.Value的实例源码
RocketChatEndpoint.java 文件源码
项目:smarti
阅读 26
收藏 0
点赞 0
评论 0
DuoAuthenticationService.java 文件源码
项目:springboot-shiro-cas-mybatis
阅读 21
收藏 0
点赞 0
评论 0
/**
* Creates the duo authentication service.
* @param duoIntegrationKey duo integration key
* @param duoSecretKey duo secret key
* @param duoApplicationKey duo application key
* @param duoApiHost duo API host url
*/
@Autowired
public DuoAuthenticationService(@NotNull @Value("${cas.duo.integration.key:}") final String duoIntegrationKey,
@NotNull @Value("${cas.duo.secret.key:}") final String duoSecretKey,
@NotNull @Value("${cas.duo.application.key:}") final String duoApplicationKey,
@NotNull @Value("${cas.duo.api.host:}") final String duoApiHost) {
if (StringUtils.isBlank(duoIntegrationKey)) {
throw new IllegalArgumentException("Duo integration key cannot be blank");
}
if (StringUtils.isBlank(duoSecretKey)) {
throw new IllegalArgumentException("Duo secret key cannot be blank");
}
if (StringUtils.isBlank(duoApplicationKey)) {
throw new IllegalArgumentException("Duo application key cannot be blank");
}
if (StringUtils.isBlank(duoApiHost)) {
throw new IllegalArgumentException("Duo api host cannot be blank");
}
this.duoIntegrationKey = duoIntegrationKey;
this.duoSecretKey = duoSecretKey;
this.duoApplicationKey = duoApplicationKey;
this.duoApiHost = duoApiHost;
}
EmbeddedServerConfig.java 文件源码
项目:secrets-proxy
阅读 25
收藏 0
点赞 0
评论 0
/**
* Configures the embedded jetty server. The values are configured in
* <b>application.yaml</b> file.
*
* @param port jetty server port
* @param maxThreads thread pool min thread
* @param minThreads thread pool max thread
* @param idleTimeout maximum thread idle time
* @param jmxEnabled true, if jetty jmx is enabled.
* @return {@link JettyEmbeddedServletContainerFactory}
*/
@Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(@Value("${server.port:8443}") final int port,
@Value("${jetty.thread-pool.max-threads:200}") final int maxThreads,
@Value("${jetty.thread-pool.min-threads:8}") final int minThreads,
@Value("${jetty.thread-pool.idle-timeout:60000}") final int idleTimeout,
@Value("${jetty.jmx.enabled:true}") final boolean jmxEnabled) {
log.info("Configuring Jetty server.");
final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(port);
factory.addServerCustomizers(server -> {
final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class);
threadPool.setMinThreads(minThreads);
threadPool.setMaxThreads(maxThreads);
threadPool.setIdleTimeout(idleTimeout);
log.info("Server thread pool config: " + server.getThreadPool());
// Jetty JMX config.
if (jmxEnabled) {
log.info("Exposing Jetty managed beans to the JMX platform server.");
server.addBean(new MBeanContainer(ManagementFactory.getPlatformMBeanServer()));
}
});
return factory;
}
YggdrasilMockServer.java 文件源码
项目:yggdrasil-mock
阅读 27
收藏 0
点赞 0
评论 0
@Bean
public ServerMeta serverMeta(@Value("#{publickeyPem}") String publickeyPem) {
ServerMeta meta = new ServerMeta();
meta.setSignaturePublickey(publickeyPem);
meta.setSkinDomains(skinDomains);
meta.setMeta(ofEntries(
entry("serverName", "yggdrasil mock server"),
entry("implementationName", "yggdrasil-mock-server"),
entry("implementationVersion", "0.0.1")));
return meta;
}
JcifsConfig.java 文件源码
项目:springboot-shiro-cas-mybatis
阅读 29
收藏 0
点赞 0
评论 0
/**
* Sets the kerberos conf.
*
* @param kerberosConf the new kerberos conf
*/
@Autowired
public void setKerberosConf(@Value("${cas.spnego.kerb.conf:}") final String kerberosConf) {
if (StringUtils.isNotBlank(kerberosConf)) {
logger.debug("kerberosConf is set to :{}", kerberosConf);
System.setProperty(SYS_PROP_KERBEROS_CONF, kerberosConf);
}
}
CatalogClient.java 文件源码
项目:microservice-kubernetes
阅读 24
收藏 0
点赞 0
评论 0
@Autowired
public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
@Value("${catalog.service.port:8080}") long catalogServicePort) {
super();
this.restTemplate = getRestTemplate();
this.catalogServiceHost = catalogServiceHost;
this.catalogServicePort = catalogServicePort;
}
LoggingConfiguration.java 文件源码
项目:jhipster-microservices-example
阅读 19
收藏 0
点赞 0
评论 0
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);
}
}
CatalogClient.java 文件源码
项目:microservice-kubernetes
阅读 30
收藏 0
点赞 0
评论 0
@Autowired
public CatalogClient(@Value("${catalog.service.host:catalog}") String catalogServiceHost,
@Value("${catalog.service.port:8080}") long catalogServicePort) {
super();
this.restTemplate = getRestTemplate();
this.catalogServiceHost = catalogServiceHost;
this.catalogServicePort = catalogServicePort;
}
ContextConfiguration.java 文件源码
项目:kalinka
阅读 25
收藏 0
点赞 0
评论 0
@Value("${kafka.subscribed.topics}")
public void setKafkaSuscribedTopics(final String rawKafkaSubscribedTopics) {
final List<String> topicNumThreadPairs = splitCsStrings(rawKafkaSubscribedTopics);
this.kafkaSubscribedTopics = topicNumThreadPairs.stream().map(p -> {
final List<String> topicNumThreadPair = Splitter.on(':').omitEmptyStrings().splitToList(p);
return new TopicInfo(topicNumThreadPair.get(0), topicNumThreadPair.size() == 2 ? Integer.valueOf(topicNumThreadPair.get(1)) : 1);
}).collect(Collectors.toList());
}
JsonMarshallerConfiguration.java 文件源码
项目:martini-core
阅读 20
收藏 0
点赞 0
评论 0
@Bean
StepResultSerializer getStepResultSerializer(
@Value("${json.step.result.serializer.impl:#{null}}") Class<? extends StepResultSerializer> impl
) {
return null == impl ?
beanFactory.createBean(DefaultStepResultSerializer.class) :
beanFactory.createBean(impl);
}
CommonBeans.java 文件源码
项目:circus-train
阅读 27
收藏 0
点赞 0
评论 0
@Profile({ Modules.REPLICATION })
@Bean
Supplier<CloseableMetaStoreClient> sourceMetaStoreClientSupplier(
SourceCatalog sourceCatalog,
@Value("#{sourceHiveConf}") HiveConf sourceHiveConf,
MetaStoreClientFactoryManager metaStoreClientFactoryManager) {
String metaStoreUris = sourceCatalog.getHiveMetastoreUris();
if (metaStoreUris == null) {
// Default to Thrift is not specified - optional attribute in SourceCatalog
metaStoreUris = ThriftMetaStoreClientFactory.ACCEPT_PREFIX;
}
MetaStoreClientFactory sourceMetaStoreClientFactory = metaStoreClientFactoryManager.factoryForUrl(metaStoreUris);
return metaStoreClientSupplier(sourceCatalog.getName(), sourceHiveConf, sourceCatalog.getMetastoreTunnel(),
sourceMetaStoreClientFactory);
}
JcifsConfig.java 文件源码
项目:springboot-shiro-cas-mybatis
阅读 31
收藏 0
点赞 0
评论 0
/**
* Sets the use subject creds only.
*
* @param useSubjectCredsOnly the new use subject creds only
*/
@Autowired
public void setUseSubjectCredsOnly(@Value("${cas.spnego.use.subject.creds:false}")
final boolean useSubjectCredsOnly) {
logger.debug("useSubjectCredsOnly is set to {}", useSubjectCredsOnly);
System.setProperty(SYS_PROP_USE_SUBJECT_CRED_ONLY, Boolean.toString(useSubjectCredsOnly));
}
LoggingConfiguration.java 文件源码
项目:TorgCRM-Server
阅读 23
收藏 0
点赞 0
评论 0
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);
}
}
CustomBeanValidationPostProcessor.java 文件源码
项目:cas-server-4.2.1
阅读 17
收藏 0
点赞 0
评论 0
@Override
@Autowired
public void setAfterInitialization(
@Value("${validation.processing.afterinit:true}")
final boolean afterInitialization) {
super.setAfterInitialization(afterInitialization);
}
DefaultMixologist.java 文件源码
项目:martini-core
阅读 22
收藏 0
点赞 0
评论 0
@Autowired
protected DefaultMixologist(
GherkinResourceLoader loader,
Mixology mixology,
Categories categories,
@Value("${unimplemented.steps.fatal:#{false}}") boolean missingStepFatal
) {
this.loader = loader;
this.mixology = mixology;
this.categories = categories;
this.unimplementedStepsFatal = missingStepFatal;
this.martinisReference = new AtomicReference<>();
}
HashingService.java 文件源码
项目:security-karate
阅读 23
收藏 0
点赞 0
评论 0
@Autowired
public HashingService(@Value("${karate.hashing.pepper}") String pepperValue) {
try {
pepper = pepperValue;
salt = getSalt();
digest = MessageDigest.getInstance("SHA-256");
ensureInitOfPepper();
} catch (Exception e) {
//Wrap Exception into RuntimeException...
throw new IllegalStateException("HashingService not correctly intialized!", e);
}
}
SourceFactory.java 文件源码
项目:circus-train
阅读 23
收藏 0
点赞 0
评论 0
@Autowired
public SourceFactory(
SourceCatalog sourceCatalog,
@Value("#{sourceHiveConf}") HiveConf sourceHiveConf,
@Value("#{sourceMetaStoreClientSupplier}") Supplier<CloseableMetaStoreClient> sourceMetaStoreClientSupplier,
SourceCatalogListener sourceCatalogListener) {
this.sourceCatalog = sourceCatalog;
this.sourceHiveConf = sourceHiveConf;
this.sourceMetaStoreClientSupplier = sourceMetaStoreClientSupplier;
this.sourceCatalogListener = sourceCatalogListener;
}
FacebookLoginFilter.java 文件源码
项目:OAuth-2.0-Cookbook
阅读 33
收藏 0
点赞 0
评论 0
public FacebookLoginFilter(
@Value("${facebook.filter.callback-uri}") String callbackUri,
@Value("${facebook.filter.api-base-uri}")String apiBaseUri) {
super(new OrRequestMatcher(
new AntPathRequestMatcher(callbackUri),
new AntPathRequestMatcher(apiBaseUri)
));
this.localMatcher = new AntPathRequestMatcher(apiBaseUri);
setAuthenticationManager(new NoopAuthenticationManager());
}
GoodPasswordGenerator.java 文件源码
项目:ARCLib
阅读 24
收藏 0
点赞 0
评论 0
@Inject
public GoodPasswordGenerator(@Value("${security.password.length}") Integer minPasswordLength,
@Value("${security.password.digit}") Boolean requireDigit,
@Value("${security.password.alphabet}") Boolean requireAlphabet) {
this.minPasswordLength = minPasswordLength;
this.requireDigit = requireDigit;
this.requireAlphabet = requireAlphabet;
LengthRule lengthRule = new LengthRule(minPasswordLength, Integer.MAX_VALUE);
WhitespaceRule whitespaceRule = new WhitespaceRule();
// control allowed characters
characterRules = new ArrayList<>();
if (requireDigit) {
characterRules.add(new CharacterRule(EnglishCharacterData.Digit, 1));
}
if (requireAlphabet) {
characterRules.add(new CharacterRule(EnglishCharacterData.Alphabetical, 1));
}
CharacterCharacteristicsRule charRule = new CharacterCharacteristicsRule();
charRule.getRules().addAll(characterRules);
charRule.setNumberOfCharacteristics(charRule.getRules().size());
// group all rules together in a List
rules = new ArrayList<>();
rules.add(lengthRule);
rules.add(whitespaceRule);
rules.add(charRule);
}
GherkinConfiguration.java 文件源码
项目:martini-core
阅读 27
收藏 0
点赞 0
评论 0
@Bean
Mixology getMixology(
@Value("${martini.mixology:#{null}}") Class<? extends Mixology> impl
) {
return null == impl ?
beanFactory.createBean(DefaultMixology.class) : beanFactory.createBean(impl);
}
SimpMessagingServiceImpl.java 文件源码
项目:jwala
阅读 22
收藏 0
点赞 0
评论 0
@Autowired
public SimpMessagingServiceImpl(final SimpMessagingTemplate messagingTemplate,
@Value("${spring.messaging.topic.serverStates:/topic/server-states}")
final String topic) {
this.messagingTemplate = messagingTemplate;
this.topic = topic;
}
Mongo.java 文件源码
项目:tapir
阅读 22
收藏 0
点赞 0
评论 0
@Autowired
public Mongo(@Value("${mongo.partition}") String partition,
@Value("${mongo.batchSize}") int batchSize,
MongoDatabase db) {
this.partition = PartitionFactory.ofPattern(partition);
this.batchSize = batchSize;
this.db = db;
}
AemServiceConfiguration.java 文件源码
项目:jwala
阅读 28
收藏 0
点赞 0
评论 0
@Bean(name = "jvmTaskExecutor")
public TaskExecutor getJvmTaskExecutor(@Qualifier("pollingThreadFactory") final ThreadFactory threadFactory,
@Value("${jvm.thread-task-executor.pool.size}") final int corePoolSize,
@Value("${jvm.thread-task-executor.pool.max-size}") final int maxPoolSize,
@Value("${jvm.thread-task-executor.pool.queue-capacity}") final int queueCapacity,
@Value("${jvm.thread-task-executor.pool.keep-alive-sec}") final int keepAliveSeconds) {
final ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(corePoolSize);
threadPoolTaskExecutor.setMaxPoolSize(maxPoolSize);
threadPoolTaskExecutor.setQueueCapacity(queueCapacity);
threadPoolTaskExecutor.setKeepAliveSeconds(keepAliveSeconds);
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
threadPoolTaskExecutor.setThreadFactory(threadFactory);
return threadPoolTaskExecutor;
}
TableComparatorFactory.java 文件源码
项目:circus-train
阅读 18
收藏 0
点赞 0
评论 0
@Autowired
TableComparatorFactory(
HiveEndpoint source,
HiveEndpoint replica,
ComparatorRegistry comparatorRegistry,
DiffListener diffListener,
@Value("${sourcePartitionBatchSize:1000}") short sourcePartitionBatchSize,
@Value("${replicaPartitionBufferSize:1000}") short replicaPartitionBufferSize) {
this.sourcePartitionBatchSize = sourcePartitionBatchSize;
this.replicaPartitionBufferSize = replicaPartitionBufferSize;
this.source = source;
this.replica = replica;
this.comparatorRegistry = comparatorRegistry;
this.diffListener = diffListener;
}
CMSClient.java 文件源码
项目:oneops
阅读 17
收藏 0
点赞 0
评论 0
@Bean
protected RetryTemplate getRetryTemplate(@Value("${controller.retryCount:3}") int retryCount, @Value("${controller.intial_delay:1000}") int initialDelay, @Value("${controller.maxInterval:10000}") int maxInterval) {
RetryTemplate retryTemplate = new RetryTemplate();
retryTemplate.setRetryPolicy(new SimpleRetryPolicy(retryCount, Collections.singletonMap(RestClientException.class, true)));
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(initialDelay);
backOffPolicy.setMaxInterval(maxInterval);
retryTemplate.setBackOffPolicy(backOffPolicy);
retryTemplate.setThrowLastExceptionOnExhausted(true);
retryTemplate.registerListener(new DefaultListenerSupport());
return retryTemplate;
}
AemServiceConfiguration.java 文件源码
项目:jwala
阅读 27
收藏 0
点赞 0
评论 0
@Bean(name = "jvmService")
public JvmService getJvmService(final GroupPersistenceService groupPersistenceService,
final ApplicationService applicationService,
final ResourceService resourceService, final ClientFactoryHelper clientFactoryHelper,
@Value("${spring.messaging.topic.serverStates:/topic/server-states}") final String topicServerStates,
final JvmControlService jvmControlService, final HistoryFacadeService historyFacadeService,
final FileUtility fileUtility) {
final JvmPersistenceService jvmPersistenceService = aemPersistenceServiceConfiguration.getJvmPersistenceService();
return new JvmServiceImpl(jvmPersistenceService, groupPersistenceService, applicationService,
messagingTemplate, groupStateNotificationService, resourceService,
clientFactoryHelper, topicServerStates, jvmControlService, binaryDistributionService, binaryDistributionLockManager,
historyFacadeService, fileUtility);
}
MartiniConfiguration.java 文件源码
项目:martini-core
阅读 20
收藏 0
点赞 0
评论 0
@Bean
public Categories getCategories(
@Value("${categories.implementation:#{null}}") Class<? extends Categories> impl
) {
return null == impl ?
beanFactory.createBean(DefaultCategories.class) :
beanFactory.createBean(impl);
}
TGCCipherExecutor.java 文件源码
项目:springboot-shiro-cas-mybatis
阅读 92
收藏 0
点赞 0
评论 0
/**
* Instantiates a new Tgc cipher executor.
*
* @param secretKeyEncryption the secret key encryption
* @param secretKeySigning the secret key signing
*/
@Autowired
public TGCCipherExecutor(@Value("${tgc.encryption.key:}")
final String secretKeyEncryption,
@Value("${tgc.signing.key:}")
final String secretKeySigning) {
super(secretKeyEncryption, secretKeySigning);
}
WebSecurityConfig.java 文件源码
项目:Sound.je
阅读 26
收藏 0
点赞 0
评论 0
/**
* Instantiates a new Web security config.
*
* @param secureCookie the secure cookie
* @param userDetailsService the user details service
* @param dataSource the data source
* @param serverConfigSettings the server config settings
*/
@Autowired
public WebSecurityConfig(@Value("${security.secure_cookie}") final Boolean secureCookie,
final DetailsService userDetailsService,
final DataSource dataSource,
ServerConfigSettings serverConfigSettings, final EndpointPermissionsManifest endpointPermissionsManifest) {
this.secureCookie = secureCookie;
this.userDetailsService = userDetailsService;
this.dataSource = dataSource;
this.serverConfigSettings = serverConfigSettings;
this.endpointPermissions = endpointPermissionsManifest;
}
CommonBeans.java 文件源码
项目:circus-train
阅读 24
收藏 0
点赞 0
评论 0
@Profile({ Modules.REPLICATION })
@Bean
Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier(
ReplicaCatalog replicaCatalog,
@Value("#{replicaHiveConf}") HiveConf replicaHiveConf,
MetaStoreClientFactoryManager metaStoreClientFactoryManager) {
MetaStoreClientFactory replicaMetaStoreClientFactory = metaStoreClientFactoryManager
.factoryForUrl(replicaCatalog.getHiveMetastoreUris());
return metaStoreClientSupplier(replicaCatalog.getName(), replicaHiveConf, replicaCatalog.getMetastoreTunnel(),
replicaMetaStoreClientFactory);
}