org.springframework.boot.context.properties.ConfigurationProperties Java Examples

The following examples show how to use org.springframework.boot.context.properties.ConfigurationProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessEngineAutoConfiguration.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Bean
@ProcessAsyncHistory
@ConfigurationProperties(prefix = "flowable.process.async-history.executor")
@ConditionalOnMissingBean(name = "asyncHistoryExecutor")
@ConditionalOnProperty(prefix = "flowable.process", name = "async-history.enable")
public SpringAsyncHistoryExecutor asyncHistoryExecutor(
    ObjectProvider<TaskExecutor> taskExecutor,
    @Process ObjectProvider<TaskExecutor> processTaskExecutor,
    ObjectProvider<SpringRejectedJobsHandler> rejectedJobsHandler,
    @Process ObjectProvider<SpringRejectedJobsHandler> processRejectedJobsHandler
) {
    return new SpringAsyncHistoryExecutor(
        getIfAvailable(processTaskExecutor, taskExecutor),
        getIfAvailable(processRejectedJobsHandler, rejectedJobsHandler)
    );
}
 
Example #2
Source File: DataSourceConfiguration.java    From dk-foundation with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Bean(name = "myBatisDataSource")
    @Primary
    @ConfigurationProperties(prefix = "data-source.single-db")
    public DataSource userDataSource() throws IOException, SQLException {
        if(!useMasterSlaveDataSource) {
            logger.info("-------------------- singleDB DataSource init ---------------------");
            return DataSourceBuilder.create().build();
        }else {
            logger.info("-------------------- masterSlave DataSource init ---------------------");
//            DataSource dataSource = YamlMasterSlaveDataSourceFactory.createDataSource(new File(
//                    DataSourceConfiguration.class.getResource("/META-INF/yamlMasterSlave.yaml").getFile()));
//            return dataSource;
            return null == masterSlaveProperties.getMasterDataSourceName()
                    ? ShardingDataSourceFactory.createDataSource(dataSourceMap, shardingProperties.getShardingRuleConfiguration(), configMapProperties.getConfigMap(), propMapProperties.getProps())
                    : MasterSlaveDataSourceFactory.createDataSource(
                    dataSourceMap, masterSlaveProperties.getMasterSlaveRuleConfiguration(), configMapProperties.getConfigMap(), propMapProperties.getProps());
        }
    }
 
Example #3
Source File: AwsAutoConfiguration.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Provide a configuration properties bean for Spring Cloud resource loader properties if for whatever reason
 * the {@link ContextResourceLoaderAutoConfiguration} isn't applied by the agent app.
 *
 * @return A {@link AwsS3ResourceLoaderProperties} instance with the bindings from cloud.aws.loader values
 */
@Bean
@ConditionalOnMissingBean(AwsS3ResourceLoaderProperties.class)
@ConfigurationProperties(ContextResourceLoaderAutoConfiguration.AWS_LOADER_PROPERTY_PREFIX)
public AwsS3ResourceLoaderProperties awsS3ResourceLoaderProperties() {
    return new AwsS3ResourceLoaderProperties();
}
 
Example #4
Source File: DruidConfig.java    From supplierShop with MIT License 5 votes vote down vote up
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties)
{
    DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
    return druidProperties.dataSource(dataSource);
}
 
Example #5
Source File: DruidDataSourceConfig.java    From SuperBoot with MIT License 5 votes vote down vote up
/**
 * DataSource 读数据源配置
 *
 * @return
 */
@ConfigurationProperties(prefix = "spring.datasource.readDruidDataSource")
@Qualifier("readDruidDataSource")
@Bean(name = "readDruidDataSource")
public DruidDataSource readDruidDataSource() {
    return DruidDataSourceBuilder.create().build(env, "spring.datasource.readDruidDataSource.");
}
 
Example #6
Source File: ConfigurationPropertiesDestructionRebindingHelper.java    From spring-cloud-formula with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcessBeforeDestruction(Object bean, String name) throws BeansException {
    if (environment == null) {
        return;
    }

    Object target = bean;
    if (AopUtils.isAopProxy(bean)) {
        target = ProxyUtils.getTargetObject(target);
    }

    if (AnnotationUtils.findAnnotation(target.getClass(), ConfigurationProperties.class) == null) {
        return;
    }

    try {
        target.getClass().getConstructor();
    } catch (NoSuchMethodException e) {
        logger.debug("can not found default constructor, skip it");
        return;
    }

    try {
        ConfigurationProperties annotation = AnnotationUtils.findAnnotation(
                target.getClass(), ConfigurationProperties.class);
        String prefix = annotation.prefix();
        Object result = Binder.get(environment).bind(prefix, (Class) target.getClass()).orElseCreate(target.getClass());
        BeanUtils.copyProperties(result, target);
    } catch (Throwable t) {
        logger.warn("error while process destruction bean with name: {}", name, t);
    }
}
 
Example #7
Source File: MultipleSourceMain.java    From SpringBootUnity with MIT License 5 votes vote down vote up
/**
 * 第二个数据源
 * @return 数据源实例
 */
@Bean(name = "secondaryDataSource")
@Qualifier("secondaryDataSource")
@Primary
@ConfigurationProperties(prefix = "spring.datasource.secondary")
public DataSource secondaryDataSource() {
    return DataSourceBuilder.create().build();
}
 
Example #8
Source File: DataSourceConfig.java    From multitenancy with GNU General Public License v2.0 5 votes vote down vote up
@Bean(name = { "dataSource", "dataSource1" })
@ConfigurationProperties(prefix = "spring.multitenancy.datasource1")
public DataSource dataSource1() {
	DataSourceBuilder factory = DataSourceBuilder
			.create(this.multitenancyProperties.getDatasource1().getClassLoader())
			.driverClassName(this.multitenancyProperties.getDatasource1().getDriverClassName())
			.username(this.multitenancyProperties.getDatasource1().getUsername())
			.password(this.multitenancyProperties.getDatasource1().getPassword())
			.url(this.multitenancyProperties.getDatasource1().getUrl());
	return factory.build();
}
 
Example #9
Source File: MasterDruidDataSourceConfig.java    From SpringBoot-Study with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #10
Source File: PrimaryJpaConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
/**
 * 扫描spring.jpa.primary开头的配置信息
 *
 * @return jpa配置信息
 */
@Primary
@Bean(name = "primaryJpaProperties")
@ConfigurationProperties(prefix = "spring.jpa.primary")
public JpaProperties jpaProperties() {
    return new JpaProperties();
}
 
Example #11
Source File: AbstractAdapterConfig.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Exposes configuration properties for ResourceLimitChecks as a Spring bean.
 *
 * @return The properties.
 */
@Bean
@ConfigurationProperties(prefix = "hono.resource-limits.prometheus-based")
@ConditionalOnClass(name = "io.micrometer.prometheus.PrometheusMeterRegistry")
@ConditionalOnProperty(name = "hono.resource-limits.prometheus-based.host")
public PrometheusBasedResourceLimitChecksConfig resourceLimitChecksConfig() {
    return new PrometheusBasedResourceLimitChecksConfig();
}
 
Example #12
Source File: AdminServerNotifierAutoConfiguration.java    From spring-boot-admin with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties("spring.boot.admin.notify.letschat")
public LetsChatNotifier letsChatNotifier(InstanceRepository repository,
		NotifierProxyProperties proxyProperties) {
	return new LetsChatNotifier(repository, createNotifierRestTemplate(proxyProperties));
}
 
Example #13
Source File: DataSourceConfiguration.java    From event-sourcing-microservices-example with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@ConfigurationProperties("spring.datasource")
@LiquibaseDataSource
public DataSource dataSource(DataSourceProperties properties) {
	return new SimpleDriverDataSource(new org.postgresql.Driver(), properties.getUrl(),
			properties.getDataUsername(), properties.getDataPassword());
}
 
Example #14
Source File: DefaultEmbeddedWebappsAutoConfiguration.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Bean(BEAN_DEFAULT_EMBEDDED_WEBAPPS_PROPERTIES)
@ConfigurationProperties(prefix = KEY_EMBEDDED_WEBAPP_BASE)
@ConditionalOnProperty(value = KEY_EMBEDDED_WEBAPP_BASE + ".enabled", matchIfMissing = false)
public GenericEmbeddedWebappsProperties defaultEmbeddedWebappsEndpointProperties() {
	return new GenericEmbeddedWebappsProperties() {
	};
}
 
Example #15
Source File: AopAuthorizeAutoConfiguration.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
@Bean
@ConfigurationProperties(prefix = "hsweb.authorize")
public AopAuthorizingController aopAuthorizingController(AuthorizingHandler authorizingHandler,
                                                         AopMethodAuthorizeDefinitionParser aopMethodAuthorizeDefinitionParser) {

    return  new AopAuthorizingController(authorizingHandler, aopMethodAuthorizeDefinitionParser);
}
 
Example #16
Source File: AuthorizationServerConfiguration.java    From spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
    // 配置数据源(注意,我使用的是 HikariCP 连接池),以上注解是指定数据源,否则会有冲突
    return DataSourceBuilder.create().build();
}
 
Example #17
Source File: DruidConfig.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties)
{
    DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
    return druidProperties.dataSource(dataSource);
}
 
Example #18
Source File: JobsDatabaseAutoConfiguration.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 数据源信息
 *
 * @return
 */
@Primary
@Bean(name = DATABASE_PREFIX + "DruidDataSource")
@ConfigurationProperties(prefix = "spring.datasource.druid")
public DataSource druidDataSource() {
    return DruidDataSourceBuilder.create().build();
}
 
Example #19
Source File: HotrodCacheConfig.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Gets properties for configuring the service's common cache aspects.
 *
 * @return The properties.
 */
@Bean
@ConfigurationProperties(prefix = "hono.device-connection.common")
@ConditionalOnProperty(prefix = "hono.device-connection", name = "server-list")
public CommonCacheConfig commonCacheConfig() {
    return new CommonCacheConfig();
}
 
Example #20
Source File: MyBatisOAuthConfig.java    From mini-platform with MIT License 5 votes vote down vote up
@Primary
@RefreshScope
@Bean(name = "dataSourceOAuth")
@ConfigurationProperties(prefix = "spring.datasource.oauth")
public DataSource dataSourceOAuth() {
    return DataSourceBuilder.create().build();
}
 
Example #21
Source File: CuratorConfiguration.java    From Kafdrop with Apache License 2.0 5 votes vote down vote up
@Primary
@Bean
@ConfigurationProperties(prefix = "kafka.zookeeper")
public ZookeeperProperties zookeeperProperties()
{
   return new ZookeeperProperties();
}
 
Example #22
Source File: OAuth2FileAutoConfiguration.java    From hsweb-framework with Apache License 2.0 4 votes vote down vote up
@ConfigurationProperties(prefix = "hsweb.oauth2.file-server")
@Bean
public OAuth2FileService oAuth2FileService() {
    return new OAuth2FileService();
}
 
Example #23
Source File: SecurityConfig.java    From movie-db-java-on-azure with MIT License 4 votes vote down vote up
@Bean
@ConfigurationProperties("facebook.resource")
public ResourceServerProperties facebookResource() {
    return new ResourceServerProperties();
}
 
Example #24
Source File: OneLoginConfiguration.java    From cerberus with Apache License 2.0 4 votes vote down vote up
@Bean
@ConfigurationProperties("cerberus.auth.user.connector.one-login")
public OneLoginConfigurationProperties oneLoginConfigurationProperties() {
  return new OneLoginConfigurationProperties();
}
 
Example #25
Source File: GumgumConfiguration.java    From prebid-server-java with Apache License 2.0 4 votes vote down vote up
@Bean("gumgumConfigurationProperties")
@ConfigurationProperties("adapters.gumgum")
BidderConfigurationProperties configurationProperties() {
    return new BidderConfigurationProperties();
}
 
Example #26
Source File: AdminServerNotifierAutoConfiguration.java    From Moss with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties("spring.boot.admin.notify.letschat")
public LetsChatNotifier letsChatNotifier(InstanceRepository repository) {
    return new LetsChatNotifier(repository);
}
 
Example #27
Source File: ImprovedigitalConfiguration.java    From prebid-server-java with Apache License 2.0 4 votes vote down vote up
@Bean("improvedigitalConfigurationProperties")
@ConfigurationProperties("adapters.improvedigital")
BidderConfigurationProperties configurationProperties() {
    return new BidderConfigurationProperties();
}
 
Example #28
Source File: GlusterCossAutoConfiguration.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnProperty(name = KEY_PROPERTY_PREFIX + ".enable", matchIfMissing = false)
@ConfigurationProperties(prefix = KEY_PROPERTY_PREFIX)
public GlusterFsCossProperties glusterCossProperties() {
	return new GlusterFsCossProperties();
}
 
Example #29
Source File: ConsumableConfiguration.java    From prebid-server-java with Apache License 2.0 4 votes vote down vote up
@Bean("consumableConfigurationProperties")
@ConfigurationProperties("adapters.consumable")
BidderConfigurationProperties configurationProperties() {
    return new BidderConfigurationProperties();
}
 
Example #30
Source File: RemoteJudgeConfiguration.java    From kayenta with Apache License 2.0 4 votes vote down vote up
@Bean
@ConfigurationProperties("kayenta.remote-judge")
RemoteJudgeConfigurationProperties remoteJudgeConfigurationProperties() {
  return new RemoteJudgeConfigurationProperties();
}