本文整理汇总了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;
}