Java 类org.springframework.boot.context.properties.ConfigurationProperties 实例源码

项目:spring-security-oauth2-boot    文件:OAuth2AuthorizationServerConfiguration.java   
@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;
}
项目:druid-boot-starter    文件:DruidServletAutoConfiguration.java   
@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;
}
项目:xitikit-blue    文件:B2CPolicyAutoConfiguration.java   
@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();
}
项目:extended-actuator-health-endpoints    文件:ExtendedHealthEndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(AliveHealthEndpoint.class)
@ConfigurationProperties("extended.health.alive")
public AliveHealthEndpoint applicationAliveEndpoint() {

    return new AliveHealthEndpoint("alive", new OrderedHealthAggregator());
}
项目:REST-Web-Services    文件:WebDatasourceConfig.java   
/**
 * Get data source.
 *
 * @return Data source
 */
@Primary
@Bean
@ConfigurationProperties(prefix="spring.datasource")
public DataSource getDatasource() {
    return DataSourceBuilder.create().build();
}
项目:read-write-sever    文件:DatabaseConfig.java   
@Bean(name="writeDataSource", destroyMethod = "close", initMethod="init")
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource writeDataSource() {
    logger.info("初始化写入数据源……");
    return DataSourceBuilder.create().type(dataSourceType).build();
}
项目:sds    文件:RedisConfig.java   
@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;
}
项目:jeeWe    文件:MvcViewConfiguration.java   
@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();
}
项目:xitikit-blue    文件:B2CPolicyAutoConfiguration.java   
@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();
}
项目:extended-actuator-health-endpoints    文件:ExtendedHealthEndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(DetailHealthEndpoint.class)
@ConfigurationProperties("extended.health.detail")
public DetailHealthEndpoint detailHealthEndpoint() {

    return new DetailHealthEndpoint("detail", new OrderedHealthAggregator());
}
项目:participationSystem3a    文件:DataSourceBean.java   
@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();
}
项目:ARCLib    文件:Gatherer.java   
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;
}
项目:lemon-dubbo-message    文件:DatabaseConfiguration.java   
@Primary
@Bean(name= "dataSource", destroyMethod= "close", initMethod="init")
   @ConfigurationProperties(prefix="spring.dataSource")
   public DataSource dataSource() {
    logger.debug("Configruing DataSource");
    return new DruidDataSource();
   }
项目:MI-S    文件:DataBaseConfiguration.java   
/**
 * 主库配置(负责写)
 * @return
 */
@Bean(name="masterDataSource")
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource writeDataSource() {
    log.info("-------------------- Master DataSource init ---------------------");
    return DataSourceBuilder.create().type(dataSourceType).build();
}
项目:druid-boot-starter    文件:DruidTypeAopAutoConfiguration.java   
@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;
}
项目:xcx-specialty    文件:RedisConfiguration.java   
@Bean  
@ConfigurationProperties(prefix="spring.redis")  
public JedisConnectionFactory getConnectionFactory(){  
    JedisConnectionFactory factory = new JedisConnectionFactory();  
    JedisPoolConfig config = getRedisConfig();  
    factory.setPoolConfig(config);  
    System.out.println("JedisConnectionFactory bean init success.");  
    return factory;  
}
项目:data-migration    文件:DataSourceConfiguration.java   
@Bean
@Primary
@Qualifier("jpaDataSource")
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource createJpaDataSource() {
    return DataSourceBuilder.create().type(dataSourceType).build();
}
项目:calcite-sql-rewriter    文件:SqlRewriterConfiguration.java   
@Bean
@ConfigurationProperties("calcite.datasource")
public DataSource calciteDataSource(@Autowired String inlineModel) {
    DataSource dataSource = DataSourceBuilder
            .create()
            .driverClassName("org.apache.calcite.jdbc.Driver")
            .url("jdbc:calcite:lex=JAVA;model=inline:" + inlineModel)
            .build();

    log.info("Generated Calcite mode: " + inlineModel);
    return dataSource;
}
项目:learn-spring-cloud    文件:StartGatewayDynamicServer.java   
/**
 *
 */
@Bean
@RefreshScope
@ConfigurationProperties("zuul")
public ZuulProperties zuulProperties() {
    return new ZuulProperties();
}
项目:SpringBoot-Study    文件:MasterDruidDataSourceConfig.java   
@ConfigurationProperties(prefix = "spring.datasource.master")
@Bean(name = "masterDataSource")
@Primary
public DataSource masterDataSource() {
    DruidDataSource dataSource = new DruidDataSource();
    try {
        dataSource.setFilters("stat,wall,log4j");
    } catch (SQLException e) {
        //
    }
    return dataSource;
}
项目:xitikit-blue    文件:B2CPolicyAutoConfiguration.java   
@Bean("blueKitChangeEmailPolicy")
@ConditionalOnBean(ChangeEmailPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.change-email", value = {"name", "redirect-url", "template-url"})
@ConfigurationProperties("blue-kit.b2c.policy.change-email")
public ChangeEmailPolicy blueKitChangeEmailPolicy(){

    throw new NotFoundException("'change-email' is not a valid policy (yet) provided by Microsoft's Azure AD B2C. You must manually change the email using the GraphApi instead.");
}
项目:druid-spring-boot    文件:DruidAutoConfiguration.java   
@Bean
@ConditionalOnProperty(prefix = DRUID_WALL_FILTER_PREFIX, name = "enabled", havingValue = "true")
@ConfigurationProperties(DRUID_WALL_FILTER_PREFIX)
public WallFilter wallFilter(WallConfig wallConfig) {
    log.debug("druid wall-filter init...");
    WallFilter filter = new WallFilter();
    filter.setConfig(wallConfig);
    return filter;
}
项目:druid-spring-boot    文件:DruidAutoConfiguration.java   
@Bean
@ConditionalOnProperty(prefix = DRUID_SLF4J_FILTER_PREFIX, name = "enabled", havingValue = "true")
@ConfigurationProperties(DRUID_SLF4J_FILTER_PREFIX)
public Slf4jLogFilter slf4jLogFilter() {
    log.debug("druid slf4j-filter init...");
    return new Slf4jLogFilter();
}
项目:xitikit-blue    文件:B2CPolicyAutoConfiguration.java   
@Bean("blueKitSignUpPolicy")
@ConditionalOnBean(SignUpPolicy.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.policy.sign-up", value = {"name", "redirect-url"})
@ConfigurationProperties("blue-kit.b2c.policy.sign-up")
public SignUpPolicy blueKitSignUpPolicy(){

    return new SignUpPolicy();
}
项目:druid-boot-starter    文件:DruidFilterAutoConfiguration.java   
@Bean
@ConfigurationProperties(DruidFilterProperties.DRUID_FILTER_PREFIX)
public FilterRegistrationBean druidFilter(DruidFilterProperties properties) {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    WebStatFilter filter = new WebStatFilter();
    registration.setFilter(filter);
    registration.addUrlPatterns(properties.getUrlPattern());
    registration.addInitParameter("exclusions",properties.getExclusions());
    registration.addInitParameter("sessionStatMaxCount",properties.getSessionStatMaxCount().toString());
    registration.addInitParameter("sessionStatEnable",properties.getSessionStatEnable().toString());
    registration.addInitParameter("principalSessionName",properties.getPrincipalSessionName());
    registration.addInitParameter("principalCookieName",properties.getPrincipalCookieName());
    registration.addInitParameter("profileEnable",properties.getProfileEnable().toString());
    return registration;
}
项目:Your-Microservice    文件:YourMicroserviceEnvironmentConfiguration.java   
/**
 * DataSource
 * @return DataSource
 */
@Bean
@Primary
@ConfigurationProperties(prefix="datasource.idp")
public DataSource dataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    return builder.setType(EmbeddedDatabaseType.H2).build();
}
项目:hekate    文件:StatsdMetricsPluginConfigurer.java   
/**
 * Conditionally constructs a new configuration for {@link StatsdMetricsPlugin} if application doesn't provide its own {@link Bean} of
 * {@link StatsdMetricsConfig} type.
 *
 * @return New configuration.
 */
@Bean
@ConditionalOnMissingBean(StatsdMetricsConfig.class)
@ConfigurationProperties(prefix = "hekate.metrics.statsd")
public StatsdMetricsConfig statsdMetricsConfig() {
    return new StatsdMetricsConfig();
}
项目:hekate    文件:HekateJdkCodecConfigurer.java   
/**
 * Constructs a new instance of {@link JdkCodecFactory}.
 *
 * @return Codec factory.
 */
@Bean
@Qualifier("default")
@ConfigurationProperties(prefix = "hekate.codec.jdk")
public JdkCodecFactory<Object> jdkCodecFactory() {
    return new JdkCodecFactory<>();
}
项目:hekate    文件:HekateKryoCodecConfigurer.java   
/**
 * Constructs a new instance of {@link KryoCodecFactory}.
 *
 * @return Codec factory.
 */
@Bean
@Qualifier("default")
@ConfigurationProperties(prefix = "hekate.codec.kryo")
public KryoCodecFactory<Object> kryoCodecFactory() {
    return new KryoCodecFactory<>();
}
项目:spring-boot-multidatasource    文件:DataSourceConfiguration.java   
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource.dbcp2")
public org.apache.commons.dbcp2.BasicDataSource dataSource(
        @Qualifier("dataSourceProperties") DataSourceProperties properties) {
    return createDataSource(properties,
            org.apache.commons.dbcp2.BasicDataSource.class);
}
项目:MI-S    文件:DataBaseConfiguration.java   
/**
 * 主库配置(负责写)
 * @return
 */
@Bean(name="masterDataSource", destroyMethod = "close", initMethod="init")
@Primary
@ConfigurationProperties(prefix = "spring.datasource",locations = "classpath:application.properties")
public DataSource writeDataSource() {
    log.info("-------------------- Master DataSource init ---------------------");
    return DataSourceBuilder.create().type(dataSourceType).build();
}
项目:hekate    文件:HekateStaticSeedNodeProviderConfigurer.java   
/**
 * Conditionally constructs a new configuration for {@link StaticSeedNodeProvider} if application doesn't provide its own {@link
 * Bean} of {@link StaticSeedNodeProviderConfig} type.
 *
 * @return New configuration.
 */
@Bean
@ConditionalOnMissingBean(StaticSeedNodeProviderConfig.class)
@ConfigurationProperties(prefix = "hekate.cluster.seed.static")
public StaticSeedNodeProviderConfig staticSeedNodeProviderConfig() {
    return new StaticSeedNodeProviderConfig();
}
项目:hekate    文件:HekateClusterServiceConfigurer.java   
/**
 * Conditionally constructs the configuration for a default failure detector if application doesn't provide its own {@link Bean} of
 * {@link FailureDetector} type.
 *
 * @return Configuration for {@link DefaultFailureDetector}.
 */
@Bean
@ConfigurationProperties(prefix = "hekate.cluster.health")
@ConditionalOnMissingBean({FailureDetector.class, DefaultFailureDetectorConfig.class})
public DefaultFailureDetectorConfig defaultFailureDetectorConfig() {
    return new DefaultFailureDetectorConfig();
}
项目:hekate    文件:HekateClusterServiceConfigurer.java   
/**
 * Constructs the {@link ClusterServiceFactory}.
 *
 * @param failureDetector Failure detector.
 *
 * @return Service factory.
 */
@Bean
@ConfigurationProperties(prefix = "hekate.cluster")
public ClusterServiceFactory clusterServiceFactory(Optional<FailureDetector> failureDetector) {
    ClusterServiceFactory factory = new ClusterServiceFactory();

    failureDetector.ifPresent(factory::setFailureDetector);

    listeners.ifPresent(factory::setClusterListeners);
    splitBrainDetector.ifPresent(factory::setSplitBrainDetector);
    acceptors.ifPresent(factory::setAcceptors);
    seedNodeProvider.ifPresent(factory::setSeedNodeProvider);

    return factory;
}
项目:lemon-dubbo-message    文件:SpringConfiguration.java   
@Bean
@ConfigurationProperties(prefix="app.alisms")
public AlismsClient alismsClient() {
    return new AlismsClient();
}
项目:happylifeplat-transaction    文件:TxManagerConfiguration.java   
@Bean
@ConfigurationProperties(prefix = "tx.redis")
public JedisPoolConfig getRedisPoolConfig() {
    return new JedisPoolConfig();
}
项目:spring-cloud-samples    文件:DataSourceConfig.java   
@Bean("commonDruidDataProperties")
@ConfigurationProperties(prefix = "spring.datasource.common")
public Map<String, String> beautyDruidDataProperties() {
    return new HashMap<String, String>();
}
项目:springboot-security-wechat    文件:SecurityConfig.java   
@Bean
@ConfigurationProperties(prefix = "wechat")
public ClientResources wechat() {
    return new ClientResources();
}
项目:spring-boot-multidatasource    文件:DataSourceConfiguration.java   
@Bean
@ConfigurationProperties(prefix = "spring.datasource5")
public DataSourceProperties dataSource5Properties() {
    return new DataSourceProperties();
}
项目:spring-boot-multidatasource    文件:DataSourceConfiguration.java   
@Bean
@ConfigurationProperties(prefix = "spring.datasource5.hikari")
public HikariDataSource dataSource5(@Qualifier("dataSource5Properties") DataSourceProperties properties) {
    return createDataSource(properties, HikariDataSource.class);
}