本文整理汇总了Java中org.springframework.beans.factory.annotation.Value类的典型用法代码示例。如果您正苦于以下问题:Java Value类的具体用法?Java Value怎么用?Java Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Value类属于org.springframework.beans.factory.annotation包,在下文中一共展示了Value类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SourceFactory
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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;
}
示例2: RocketChatEndpoint
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
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));
}
}
示例3: DuoAuthenticationService
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
/**
* 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;
}
示例4: jettyEmbeddedServletContainerFactory
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
/**
* 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;
}
示例5: serverMeta
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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;
}
示例6: setKerberosConf
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
/**
* 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);
}
}
示例7: CatalogClient
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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;
}
示例8: LoggingConfiguration
import org.springframework.beans.factory.annotation.Value; //导入依赖的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);
}
}
示例9: setKafkaSuscribedTopics
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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());
}
示例10: getStepResultSerializer
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@Bean
StepResultSerializer getStepResultSerializer(
@Value("${json.step.result.serializer.impl:#{null}}") Class<? extends StepResultSerializer> impl
) {
return null == impl ?
beanFactory.createBean(DefaultStepResultSerializer.class) :
beanFactory.createBean(impl);
}
示例11: sourceMetaStoreClientSupplier
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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);
}
示例12: setUseSubjectCredsOnly
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
/**
* 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));
}
示例13: LoggingConfiguration
import org.springframework.beans.factory.annotation.Value; //导入依赖的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);
}
}
示例14: setAfterInitialization
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@Override
@Autowired
public void setAfterInitialization(
@Value("${validation.processing.afterinit:true}")
final boolean afterInitialization) {
super.setAfterInitialization(afterInitialization);
}
示例15: DefaultMixologist
import org.springframework.beans.factory.annotation.Value; //导入依赖的package包/类
@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<>();
}