當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigurationProperties類代碼示例

本文整理匯總了Java中org.springframework.boot.context.properties.ConfigurationProperties的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationProperties類的具體用法?Java ConfigurationProperties怎麽用?Java ConfigurationProperties使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConfigurationProperties類屬於org.springframework.boot.context.properties包,在下文中一共展示了ConfigurationProperties類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: oauth2ClientDetails

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConfigurationProperties(prefix = "security.oauth2.client")
public BaseClientDetails oauth2ClientDetails() {
	BaseClientDetails details = new BaseClientDetails();
	if (this.client.getClientId() == null) {
		this.client.setClientId(UUID.randomUUID().toString());
	}
	details.setClientId(this.client.getClientId());
	details.setClientSecret(this.client.getClientSecret());
	details.setAuthorizedGrantTypes(Arrays.asList("authorization_code",
			"password", "client_credentials", "implicit", "refresh_token"));
	details.setAuthorities(
			AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"));
	details.setRegisteredRedirectUri(Collections.<String>emptySet());
	return details;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:17,代碼來源:OAuth2AuthorizationServerConfiguration.java

示例2: druidServlet

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConfigurationProperties(DruidServletProperties.DRUID_SERVLET_PREFIX)
public ServletRegistrationBean druidServlet(DruidServletProperties properties) {
    ServletRegistrationBean reg = new ServletRegistrationBean();
    reg.setServlet(new StatViewServlet());
    reg.addUrlMappings(properties.getUrlMappings());
    if(properties.getAllow() !=null){
        reg.addInitParameter("allow", properties.getAllow());  // IP白名單 (沒有配置或者為空,則允許所有訪問)
    }
    if(properties.getDeny() !=null){
        reg.addInitParameter("deny", properties.getDeny()); //IP黑名單 (存在共同時,deny優先於allow)
    }
    if(properties.getLoginUsername() !=null){
        reg.addInitParameter("loginUsername", properties.getLoginUsername()); //用戶名
    }
    if(properties.getLoginPassword() !=null){
        reg.addInitParameter("loginPassword", properties.getLoginPassword()); // 密碼
    }
    if(properties.getResetEnable() !=null){
        reg.addInitParameter("resetEnable", properties.getResetEnable().toString());// 禁用HTML頁麵上的“Reset All”功能
    }
    return reg;
}
 
開發者ID:cuisongliu,項目名稱:druid-boot-starter,代碼行數:24,代碼來源:DruidServletAutoConfiguration.java

示例3: blueKitEditProfilePolicy

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean("blueKitEditProfilePolicy")
@ConditionalOnBean(EditProfilePolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.edit-profile", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.edit-profile")
public EditProfilePolicy blueKitEditProfilePolicy(){

    return new EditProfilePolicy();
}
 
開發者ID:Xitikit,項目名稱:xitikit-blue,代碼行數:9,代碼來源:B2CPolicyAutoConfiguration.java

示例4: applicationAliveEndpoint

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(AliveHealthEndpoint.class)
@ConfigurationProperties("extended.health.alive")
public AliveHealthEndpoint applicationAliveEndpoint() {

    return new AliveHealthEndpoint("alive", new OrderedHealthAggregator());
}
 
開發者ID:dm-drogeriemarkt,項目名稱:extended-actuator-health-endpoints,代碼行數:8,代碼來源:ExtendedHealthEndpointAutoConfiguration.java

示例5: getDatasource

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
/**
 * Get data source.
 *
 * @return Data source
 */
@Primary
@Bean
@ConfigurationProperties(prefix="spring.datasource")
public DataSource getDatasource() {
    return DataSourceBuilder.create().build();
}
 
開發者ID:JonkiPro,項目名稱:REST-Web-Services,代碼行數:12,代碼來源:WebDatasourceConfig.java

示例6: writeDataSource

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean(name="writeDataSource", destroyMethod = "close", initMethod="init")
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource writeDataSource() {
    logger.info("初始化寫入數據源……");
    return DataSourceBuilder.create().type(dataSourceType).build();
}
 
開發者ID:jinping125,項目名稱:read-write-sever,代碼行數:8,代碼來源:DatabaseConfig.java

示例7: getConnectionFactory

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConfigurationProperties(prefix = "spring.redis")
public JedisConnectionFactory getConnectionFactory() {
    JedisConnectionFactory factory = new JedisConnectionFactory();
    JedisPoolConfig config = getRedisConfig();
    factory.setPoolConfig(config);
    logger.info("JedisConnectionFactory bean init success.");
    return factory;
}
 
開發者ID:1991wangliang,項目名稱:sds,代碼行數:10,代碼來源:RedisConfig.java

示例8: contentNegotiationManager

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConfigurationProperties("spring.mvc.viewManager")
public ContentNegotiationManager contentNegotiationManager() {
	// 聲明contentNegotiationManagerFactory工廠實例,並根據配置參數填充對象。
	ContentNegotiationManagerFactoryBean contentNegotiationManagerFactory = new ContentNegotiationManagerFactoryBean();
	// 手動填充mediaTypes參數
	Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>();
	mediaTypes.put("json", MediaType.APPLICATION_JSON_UTF8);
	mediaTypes.put("xml", MediaType.APPLICATION_XML);
	contentNegotiationManagerFactory.addMediaTypes(mediaTypes);
	// 返回contentNegotiationManager對象
	return contentNegotiationManagerFactory.getObject();
}
 
開發者ID:phoenix-varus,項目名稱:jeeWe,代碼行數:14,代碼來源:MvcViewConfiguration.java

示例9: blueKitSignInPolicy

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean("blueKitSignInPolicy")
@ConditionalOnBean(SignInPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-in", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.sign-in")
public SignInPolicy blueKitSignInPolicy(){

    return new SignInPolicy();
}
 
開發者ID:Xitikit,項目名稱:xitikit-blue,代碼行數:9,代碼來源:B2CPolicyAutoConfiguration.java

示例10: detailHealthEndpoint

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(DetailHealthEndpoint.class)
@ConfigurationProperties("extended.health.detail")
public DetailHealthEndpoint detailHealthEndpoint() {

    return new DetailHealthEndpoint("detail", new OrderedHealthAggregator());
}
 
開發者ID:dm-drogeriemarkt,項目名稱:extended-actuator-health-endpoints,代碼行數:8,代碼來源:ExtendedHealthEndpointAutoConfiguration.java

示例11: dataSource

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
	ConnectionData conData = getDbUrl();
	return DataSourceBuilder
			.create()
			.url(conData.getUrl() + "?sslmode=require")
			.username(conData.getUser())
			.password(conData.getPassword())
			.driverClassName("org.postgresql.Driver")
			.build();
}
 
開發者ID:Arquisoft,項目名稱:participationSystem3a,代碼行數:14,代碼來源:DataSourceBean.java

示例12: getConfigurationPropertiesBeans

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new LinkedHashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:12,代碼來源:Gatherer.java

示例13: dataSource

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Primary
@Bean(name= "dataSource", destroyMethod= "close", initMethod="init")
   @ConfigurationProperties(prefix="spring.dataSource")
   public DataSource dataSource() {
	logger.debug("Configruing DataSource");
	return new DruidDataSource();
   }
 
開發者ID:lemon-china,項目名稱:lemon-dubbo-message,代碼行數:8,代碼來源:DatabaseConfiguration.java

示例14: writeDataSource

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
/**
 * 主庫配置(負責寫)
 * @return
 */
@Bean(name="masterDataSource")
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource writeDataSource() {
    log.info("-------------------- Master DataSource init ---------------------");
    return DataSourceBuilder.create().type(dataSourceType).build();
}
 
開發者ID:MIYAOW,項目名稱:MI-S,代碼行數:12,代碼來源:DataBaseConfiguration.java

示例15: typeProxyCreator

import org.springframework.boot.context.properties.ConfigurationProperties; //導入依賴的package包/類
@Bean
@ConfigurationProperties(DruidStatProperties.DRUID_STAT_PREFIX)
public BeanTypeAutoProxyCreator typeProxyCreator(DruidStatProperties properties){
    if (properties.getTargetBeanType() == null){
        throw new IllegalStateException(DruidStatProperties.DRUID_STAT_PREFIX+".target-bean-type must  not null.");
    }
    BeanTypeAutoProxyCreator creator = new BeanTypeAutoProxyCreator();
    creator.setTargetBeanType(properties.getTargetBeanType());
    creator.setProxyTargetClass(proxyTargetClass);
    creator.setInterceptorNames(DruidStatProperties.DRUID_STAT_INTERCEPTOR_NAME);
    return  creator;
}
 
開發者ID:cuisongliu,項目名稱:druid-boot-starter,代碼行數:13,代碼來源:DruidTypeAopAutoConfiguration.java


注:本文中的org.springframework.boot.context.properties.ConfigurationProperties類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。