Search in sources :

Example 1 with ConditionalOnBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnBean in project spring-boot by spring-projects.

the class SecurityFilterAutoConfiguration method securityFilterChainRegistration.

@Bean
@ConditionalOnBean(name = DEFAULT_FILTER_NAME)
public DelegatingFilterProxyRegistrationBean securityFilterChainRegistration(SecurityProperties securityProperties) {
    DelegatingFilterProxyRegistrationBean registration = new DelegatingFilterProxyRegistrationBean(DEFAULT_FILTER_NAME);
    registration.setOrder(securityProperties.getFilterOrder());
    registration.setDispatcherTypes(getDispatcherTypes(securityProperties));
    return registration;
}
Also used : DelegatingFilterProxyRegistrationBean(org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) Bean(org.springframework.context.annotation.Bean) DelegatingFilterProxyRegistrationBean(org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean)

Example 2 with ConditionalOnBean

use of org.springframework.boot.autoconfigure.condition.ConditionalOnBean in project spring-boot by spring-projects.

the class BatchAutoConfiguration method jobExplorer.

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(DataSource.class)
public JobExplorer jobExplorer(DataSource dataSource) throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.afterPropertiesSet();
    return factory.getObject();
}
Also used : JobExplorerFactoryBean(org.springframework.batch.core.explore.support.JobExplorerFactoryBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) JobExplorerFactoryBean(org.springframework.batch.core.explore.support.JobExplorerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)2 Bean (org.springframework.context.annotation.Bean)2 JobExplorerFactoryBean (org.springframework.batch.core.explore.support.JobExplorerFactoryBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 DelegatingFilterProxyRegistrationBean (org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean)1