当前位置: 首页>>代码示例>>Java>>正文


Java RelaxedPropertyResolver类代码示例

本文整理汇总了Java中org.springframework.boot.bind.RelaxedPropertyResolver的典型用法代码示例。如果您正苦于以下问题:Java RelaxedPropertyResolver类的具体用法?Java RelaxedPropertyResolver怎么用?Java RelaxedPropertyResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RelaxedPropertyResolver类属于org.springframework.boot.bind包,在下文中一共展示了RelaxedPropertyResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isTemplateAvailable

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public boolean isTemplateAvailable(String view, Environment environment,
                                   ClassLoader classLoader, ResourceLoader resourceLoader) {
    if (ClassUtils.isPresent("org.apache.velocity.app.VelocityEngine", classLoader)) {
        PropertyResolver resolver = new RelaxedPropertyResolver(environment,
                "spring.velocity.");
        String loaderPath = resolver.getProperty("resource-loader-path",
                VelocityProperties.DEFAULT_RESOURCE_LOADER_PATH);
        String prefix = resolver.getProperty("prefix",
                VelocityProperties.DEFAULT_PREFIX);
        String suffix = resolver.getProperty("suffix",
                VelocityProperties.DEFAULT_SUFFIX);
        return resourceLoader.getResource(loaderPath + prefix + view + suffix)
                             .exists();
    }
    return false;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:18,代码来源:VelocityTemplateAvailabilityProvider.java

示例2: getValue

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
private String getValue(String source, String defaultValue) {
	if (this.environment == null) {
		addWarn("No Spring Environment available to resolve " + source);
		return defaultValue;
	}
	String value = this.environment.getProperty(source);
	if (value != null) {
		return value;
	}
	int lastDot = source.lastIndexOf(".");
	if (lastDot > 0) {
		String prefix = source.substring(0, lastDot + 1);
		RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
				this.environment, prefix);
		return resolver.getProperty(source.substring(lastDot + 1), defaultValue);
	}
	return defaultValue;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:SpringPropertyAction.java

示例3: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
	final RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(),
			"holon.swagger.");

	if (!resolver.getProperty("holon.swagger.enabled", boolean.class, true)) {
		return ConditionOutcome.noMatch(ConditionMessage.forCondition("SwaggerApiAutoDetectCondition")
				.because("holon.swagger.enabled is false"));
	}

	if (resolver.containsProperty("resourcePackage")) {
		return ConditionOutcome.noMatch(
				ConditionMessage.forCondition("SwaggerApiAutoDetectCondition").available("resourcePackage"));
	}
	Map<String, Object> ag = resolver.getSubProperties("apiGroups");
	if (ag != null && ag.size() > 0) {
		return ConditionOutcome
				.noMatch(ConditionMessage.forCondition("SwaggerApiAutoDetectCondition").available("apiGroups"));
	}
	return ConditionOutcome.match();
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:22,代码来源:SwaggerApiAutoDetectCondition.java

示例4: setEnvironment

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
public void setEnvironment(Environment environment) {
    this.propertyResolver = new RelaxedPropertyResolver(environment, null);
    this.url = propertyResolver.getProperty("spring.datasource.url");
    this.userName= propertyResolver.getProperty("spring.datasource.username");
    this.password = propertyResolver.getProperty("spring.datasource.password");
    this.driveClassName = propertyResolver.getProperty("spring.datasource.driver-class-name");
    this.filters = propertyResolver.getProperty("spring.datasource.filters");
    this.maxActive = propertyResolver.getProperty("spring.datasource.maxActive");
    this.initialSize = propertyResolver.getProperty("spring.datasource.initialSize");
    this.maxWait = propertyResolver.getProperty("spring.datasource.maxWait");
    this.minIdle = propertyResolver.getProperty("spring.datasource.minIdle");
    this.timeBetweenEvictionRunsMillis = propertyResolver.getProperty("spring.datasource.timeBetweenEvictionRunsMillis");
    this.minEvictableIdleTimeMillis = propertyResolver.getProperty("spring.datasource.minEvictableIdleTimeMillis");
    this.validationQuery = propertyResolver.getProperty("spring.datasource.validationQuery");
    this.testWhileIdle = propertyResolver.getProperty("spring.datasource.testWhileIdle");
    this.testOnBorrow = propertyResolver.getProperty("spring.datasource.testOnBorrow");
    this.testOnReturn = propertyResolver.getProperty("spring.datasource.testOnReturn");
    this.poolPreparedStatements = propertyResolver.getProperty("spring.datasource.poolPreparedStatements");
    this.maxOpenPreparedStatements = propertyResolver.getProperty("spring.datasource.maxOpenPreparedStatements");
    this.typeAliasesPackage = propertyResolver.getProperty("mybatis.typeAliasesPackage");
    this.xmlLocation = propertyResolver.getProperty("mybatis.xmlLocation");
}
 
开发者ID:fier-liu,项目名称:FCat,代码行数:23,代码来源:MybatisConfiguration.java

示例5: initTargetDataSources

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
/**
 * @param env
 * @Title: initTargetDataSources
 * @Description: 初始化更多数据源
 * @author Kola 6089555
 * @date 2017年4月24日 下午6:45:32
 */
private void initTargetDataSources(Environment env) {
    RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "druid.slaveSource.");
    String slaveNodes = propertyResolver.getProperty("node");
    if (StringUtils.isNotBlank(slaveNodes)) {
        for (String dsPrefix : slaveNodes.split(",")) {
            if (StringUtils.isNotBlank(dsPrefix)) {
                String dataSourceClass = new RelaxedPropertyResolver(env, "druid.slaveSource." + dsPrefix + ".").getProperty("type");
                if (StringUtils.isNotBlank(dataSourceClass)) {
                    DataSource dataSource = buildDataSource(dataSourceClass);
                    dataBinder(dataSource, env, "druid.slaveSource." + dsPrefix);
                    targetDataSources.put(dsPrefix, dataSource);
                }
            }
        }
    }
}
 
开发者ID:6089555,项目名称:spring-boot-starter-dynamic-datasource,代码行数:24,代码来源:DynamicDataSourceRegister.java

示例6: getProvider

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
/**
 * Get the provider that can be used to render the given view.
 * @param view the view to render
 * @param environment the environment
 * @param classLoader the class loader
 * @param resourceLoader the resource loader
 * @return a {@link TemplateAvailabilityProvider} or null
 */
public TemplateAvailabilityProvider getProvider(String view, Environment environment,
		ClassLoader classLoader, ResourceLoader resourceLoader) {
	Assert.notNull(view, "View must not be null");
	Assert.notNull(environment, "Environment must not be null");
	Assert.notNull(classLoader, "ClassLoader must not be null");
	Assert.notNull(resourceLoader, "ResourceLoader must not be null");

	RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(
			environment, "spring.template.provider.");
	if (!propertyResolver.getProperty("cache", Boolean.class, true)) {
		return findProvider(view, environment, classLoader, resourceLoader);
	}
	TemplateAvailabilityProvider provider = this.resolved.get(view);
	if (provider == null) {
		synchronized (this.cache) {
			provider = findProvider(view, environment, classLoader, resourceLoader);
			provider = (provider == null ? NONE : provider);
			this.resolved.put(view, provider);
			this.cache.put(view, provider);
		}
	}
	return (provider == NONE ? null : provider);
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:32,代码来源:TemplateAvailabilityProviders.java

示例7: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
			context.getEnvironment(), "spring.session.");
	StoreType sessionStoreType = SessionStoreMappings
			.getType(((AnnotationMetadata) metadata).getClassName());
	if (!resolver.containsProperty("store-type")) {
		if (sessionStoreType == StoreType.REDIS && redisPresent) {
			return ConditionOutcome
					.match("Session store type default to redis (deprecated)");
		}
		return ConditionOutcome.noMatch("Session store type not set");
	}
	String value = resolver.getProperty("store-type").replace("-", "_").toUpperCase();
	if (value.equals(sessionStoreType.name())) {
		return ConditionOutcome.match("Session store type " + sessionStoreType);
	}
	return ConditionOutcome.noMatch("Session store type " + value);
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:21,代码来源:SessionCondition.java

示例8: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	Environment environment = context.getEnvironment();
	String config = environment.resolvePlaceholders("${logging.file:}");
	if (StringUtils.hasText(config)) {
		return ConditionOutcome.match("Found logging.file: " + config);
	}
	config = environment.resolvePlaceholders("${logging.path:}");
	if (StringUtils.hasText(config)) {
		return ConditionOutcome.match("Found logging.path: " + config);
	}
	config = new RelaxedPropertyResolver(environment, "endpoints.logfile.")
			.getProperty("external-file");
	if (StringUtils.hasText(config)) {
		return ConditionOutcome
				.match("Found endpoints.logfile.external-file: " + config);
	}
	return ConditionOutcome.noMatch("Found no log file configuration");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:EndpointWebMvcManagementContextConfiguration.java

示例9: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	Environment environment = context.getEnvironment();
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
			"security.oauth2.resource.");
	Boolean preferTokenInfo = resolver.getProperty("prefer-token-info",
			Boolean.class);
	if (preferTokenInfo == null) {
		preferTokenInfo = environment
				.resolvePlaceholders("${OAUTH2_RESOURCE_PREFERTOKENINFO:true}")
				.equals("true");
	}
	String tokenInfoUri = resolver.getProperty("token-info-uri");
	String userInfoUri = resolver.getProperty("user-info-uri");
	if (!StringUtils.hasLength(userInfoUri)) {
		return ConditionOutcome.match("No user info provided");
	}
	if (StringUtils.hasLength(tokenInfoUri) && preferTokenInfo) {
		return ConditionOutcome.match(
				"Token info endpoint " + "is preferred and user info provided");
	}
	return ConditionOutcome.noMatch("Token info endpoint is not provided");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:25,代码来源:ResourceServerTokenServicesConfiguration.java

示例10: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	Environment environment = context.getEnvironment();
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
			"security.oauth2.resource.");
	if (hasOAuthClientId(environment)) {
		return ConditionOutcome.match("found client id");
	}
	if (!resolver.getSubProperties("jwt").isEmpty()) {
		return ConditionOutcome.match("found JWT resource configuration");
	}
	if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) {
		return ConditionOutcome
				.match("found UserInfo " + "URI resource configuration");
	}
	if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
		if (AuthorizationServerEndpointsConfigurationBeanCondition
				.matches(context)) {
			return ConditionOutcome.match(
					"found authorization " + "server endpoints configuration");
		}
	}
	return ConditionOutcome.noMatch("found neither client id nor "
			+ "JWT resource nor authorization server");
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:27,代码来源:OAuth2ResourceServerConfiguration.java

示例11: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
			context.getEnvironment(), "spring.cache.");
	if (!resolver.containsProperty("type")) {
		return ConditionOutcome.match("Automatic cache type");
	}
	CacheType cacheType = CacheConfigurations
			.getType(((AnnotationMetadata) metadata).getClassName());
	String value = resolver.getProperty("type").replace("-", "_").toUpperCase();
	if (value.equals(cacheType.name())) {
		return ConditionOutcome.match("Cache type " + cacheType);
	}
	return ConditionOutcome.noMatch("Cache type " + value);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:CacheCondition.java

示例12: getMatchOutcome

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
		AnnotatedTypeMetadata metadata) {
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
			context.getEnvironment(), "spring.cache.jcache.");
	if (resolver.containsProperty("provider")) {
		return ConditionOutcome.match("JCache provider specified");
	}
	Iterator<CachingProvider> providers = Caching.getCachingProviders()
			.iterator();
	if (!providers.hasNext()) {
		return ConditionOutcome.noMatch("No JSR-107 compliant providers");
	}
	providers.next();
	if (providers.hasNext()) {
		return ConditionOutcome.noMatch(
				"Multiple default JSR-107 compliant " + "providers found");

	}
	return ConditionOutcome.match("Default JSR-107 compliant provider found.");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:JCacheCacheConfiguration.java

示例13: isTemplateAvailable

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public boolean isTemplateAvailable(String view, Environment environment,
		ClassLoader classLoader, ResourceLoader resourceLoader) {
	if (ClassUtils.isPresent("org.apache.velocity.app.VelocityEngine", classLoader)) {
		PropertyResolver resolver = new RelaxedPropertyResolver(environment,
				"spring.velocity.");
		String loaderPath = resolver.getProperty("resource-loader-path",
				VelocityProperties.DEFAULT_RESOURCE_LOADER_PATH);
		String prefix = resolver.getProperty("prefix",
				VelocityProperties.DEFAULT_PREFIX);
		String suffix = resolver.getProperty("suffix",
				VelocityProperties.DEFAULT_SUFFIX);
		return resourceLoader.getResource(loaderPath + prefix + view + suffix)
				.exists();
	}
	return false;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:VelocityTemplateAvailabilityProvider.java

示例14: onApplicationEvent

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
	RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
			event.getEnvironment(), "spring.");
	if (resolver.containsProperty("mandatoryFileEncoding")) {
		String encoding = System.getProperty("file.encoding");
		String desired = resolver.getProperty("mandatoryFileEncoding");
		if (encoding != null && !desired.equalsIgnoreCase(encoding)) {
			logger.error("System property 'file.encoding' is currently '" + encoding
					+ "'. It should be '" + desired
					+ "' (as defined in 'spring.mandatoryFileEncoding').");
			logger.error("Environment variable LANG is '" + System.getenv("LANG")
					+ "'. You could use a locale setting that matches encoding='"
					+ desired + "'.");
			logger.error("Environment variable LC_ALL is '" + System.getenv("LC_ALL")
					+ "'. You could use a locale setting that matches encoding='"
					+ desired + "'.");
			throw new IllegalStateException(
					"The Java Virtual Machine has not been configured to use the "
							+ "desired default character encoding (" + desired
							+ ").");
		}
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:25,代码来源:FileEncodingApplicationListener.java

示例15: initialize

import org.springframework.boot.bind.RelaxedPropertyResolver; //导入依赖的package包/类
@Override
public void initialize(TelemetryContext telemetryContext) {
    RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(environment);
    telemetryContext.getTags().put("ai.spring-boot.version", SpringBootVersion.getVersion());
    telemetryContext.getTags().put("ai.spring.version", SpringVersion.getVersion());
    String ipAddress = relaxedPropertyResolver.getProperty("spring.cloud.client.ipAddress");
    if (ipAddress != null) {
        // if spring-cloud is available we can set ip address
        telemetryContext.getTags().put(ContextTagKeys.getKeys().getLocationIP(), ipAddress);
    }
}
 
开发者ID:gavlyukovskiy,项目名称:azure-application-insights-spring-boot-starter,代码行数:12,代码来源:SpringBootContextInitializer.java


注:本文中的org.springframework.boot.bind.RelaxedPropertyResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。