本文整理匯總了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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}