Java 类org.springframework.beans.factory.annotation.Value 实例源码

项目:smarti    文件:RocketChatEndpoint.java   
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));
    }
}
项目:springboot-shiro-cas-mybatis    文件:DuoAuthenticationService.java   
/**
 * 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;
}
项目:secrets-proxy    文件:EmbeddedServerConfig.java   
/**
 * 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;
}
项目:yggdrasil-mock    文件:YggdrasilMockServer.java   
@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;
}
项目:springboot-shiro-cas-mybatis    文件:JcifsConfig.java   
/**
 * 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);
    }
}
项目:microservice-kubernetes    文件:CatalogClient.java   
@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;
}
项目:jhipster-microservices-example    文件:LoggingConfiguration.java   
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);
    }
}
项目:microservice-kubernetes    文件:CatalogClient.java   
@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;
}
项目:kalinka    文件:ContextConfiguration.java   
@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());
}
项目:martini-core    文件:JsonMarshallerConfiguration.java   
@Bean
StepResultSerializer getStepResultSerializer(
    @Value("${json.step.result.serializer.impl:#{null}}") Class<? extends StepResultSerializer> impl
) {
    return null == impl ?
        beanFactory.createBean(DefaultStepResultSerializer.class) :
        beanFactory.createBean(impl);
}
项目:circus-train    文件:CommonBeans.java   
@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);
}
项目:springboot-shiro-cas-mybatis    文件:JcifsConfig.java   
/**
 * 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));
}
项目:TorgCRM-Server    文件:LoggingConfiguration.java   
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);
    }
}
项目:cas-server-4.2.1    文件:CustomBeanValidationPostProcessor.java   
@Override
@Autowired
public void setAfterInitialization(
        @Value("${validation.processing.afterinit:true}")
        final boolean afterInitialization) {
    super.setAfterInitialization(afterInitialization);
}
项目:martini-core    文件:DefaultMixologist.java   
@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<>();
}
项目:security-karate    文件:HashingService.java   
@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);
    }
}
项目:circus-train    文件:SourceFactory.java   
@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;
}
项目:OAuth-2.0-Cookbook    文件:FacebookLoginFilter.java   
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());
}
项目:ARCLib    文件:GoodPasswordGenerator.java   
@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);
}
项目:martini-core    文件:GherkinConfiguration.java   
@Bean
Mixology getMixology(
    @Value("${martini.mixology:#{null}}") Class<? extends Mixology> impl
) {
    return null == impl ?
        beanFactory.createBean(DefaultMixology.class) : beanFactory.createBean(impl);
}
项目:jwala    文件:SimpMessagingServiceImpl.java   
@Autowired
public SimpMessagingServiceImpl(final SimpMessagingTemplate messagingTemplate,
                                @Value("${spring.messaging.topic.serverStates:/topic/server-states}")
                                final String topic) {
    this.messagingTemplate = messagingTemplate;
    this.topic = topic;
}
项目:tapir    文件:Mongo.java   
@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;
}
项目:jwala    文件:AemServiceConfiguration.java   
@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;
}
项目:circus-train    文件:TableComparatorFactory.java   
@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;
}
项目:oneops    文件:CMSClient.java   
@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;
}
项目:jwala    文件:AemServiceConfiguration.java   
@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);
}
项目:martini-core    文件:MartiniConfiguration.java   
@Bean
public Categories getCategories(
    @Value("${categories.implementation:#{null}}") Class<? extends Categories> impl
) {
    return null == impl ?
        beanFactory.createBean(DefaultCategories.class) :
        beanFactory.createBean(impl);
}
项目:springboot-shiro-cas-mybatis    文件:TGCCipherExecutor.java   
/**
 * 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);
}
项目:Sound.je    文件:WebSecurityConfig.java   
/**
 * 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;
}
项目:circus-train    文件:CommonBeans.java   
@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);
}
项目:spring-io    文件:LoggingConfiguration.java   
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);
    }
}
项目:springboot-shiro-cas-mybatis    文件:HostNameBasedUniqueTicketIdGenerator.java   
/**
 * Instantiates a new Service ticket id generator.
 *
 * @param maxLength the max length
 * @param suffix    the suffix
 */
@Autowired
public ServiceTicketIdGenerator(@Value("${st.ticket.maxlength:20}")
                                final int maxLength,
                                @Value("${host.name:cas01.example.org}")
                                final String suffix) {
    super(maxLength, suffix);
}
项目:hub-fortify-ssc-integration-service    文件:PropertyConstants.java   
@Value("${hub.fortify.batch.job.status.file.path}")
public void setBatchJobStatusFilePath(String batchJobStatusFilePath) {
    this.batchJobStatusFilePath = batchJobStatusFilePath;
}
项目:lemon    文件:TrainModuleSpecification.java   
@Value("${application.database.type}")
public void setType(String type) {
    this.type = type;
}
项目:ARCLib    文件:KerberosConfiguration.java   
@Inject
public void setDebug(@Value("${security.kerberos.debug}") Boolean debug) {
    this.debug = debug;
}
项目:lemon    文件:AuditModuleSpecification.java   
@Value("${" + MODULE_NAME + ".dbmigrate.enabled}")
public void setEnabled(boolean enabled) {
    this.enabled = enabled;
}
项目:cas-server-4.2.1    文件:CasReloadableMessageBundle.java   
@Override
@Autowired
public void setDefaultEncoding(@Value("${message.bundle.encoding:UTF-8}")
                               final String defaultEncoding) {
    super.setDefaultEncoding(defaultEncoding);
}
项目:cas-server-4.2.1    文件:QueryAndEncodeDatabaseAuthenticationHandler.java   
/**
 * Sets salt field name. Default is {@link #DEFAULT_SALT_FIELD}.
 *
 * @param saltFieldName the password field name
 */
@Autowired
public final void setSaltFieldName(@Value("${cas.jdbc.authn.query.encode.salt:" + DEFAULT_SALT_FIELD + '}')
                                   final String saltFieldName) {
    this.saltFieldName = saltFieldName;
}
项目:lemon    文件:PerformanceModuleSpecification.java   
@Value("${" + MODULE_NAME + ".dbmigrate.enabled}")
public void setEnabled(boolean enabled) {
    this.enabled = enabled;
}
项目:ARCLib    文件:MailCenter.java   
@Inject
public void setPathTasks(@Value("${mail.app.path.tasks}") String pathTasks) {
    this.pathTasks = pathTasks;
}