org.zodiac.autoconfigure.datascope.DataScopeAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.datascope;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@SpringBootConfiguration
//@EnableConfigurationProperties(PlatformDataScopeProperties.class)
@ConditionalOnProperty(value = org.zodiac.datascope.constants.DataScopeSystemPropertiesConstants.PLATFORM_DATA_SCOPE_ENABLED, havingValue = "true")
@ConditionalOnClass(value = {org.zodiac.datascope.config.PlatformDataScopeInfo.class, org.springframework.jdbc.core.JdbcTemplate.class, org.zodiac.security.SecurityAuthOperations.class, org.zodiac.security.SecurityCacheOperations.class})
public class DataScopeAutoConfiguration {
private final org.springframework.jdbc.core.JdbcTemplate jdbcTemplate;
private final org.zodiac.security.SecurityAuthOperations2 securityAuthOperations;
private final org.zodiac.security.SecurityCacheOperations securityCacheOperations;
public DataScopeAutoConfiguration(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, org.zodiac.security.SecurityAuthOperations2 securityAuthOperations,
org.zodiac.security.SecurityCacheOperations securityCacheOperations) {
this.jdbcTemplate = jdbcTemplate;
this.securityAuthOperations = securityAuthOperations;
this.securityCacheOperations = securityCacheOperations;
}
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = org.zodiac.datascope.constants.DataScopeSystemPropertiesConstants.PLATFORM_DATA_SCOPE_PREFIX, ignoreInvalidFields = true)
protected PlatformDataScopeProperties dataScopeProperties() {
return new PlatformDataScopeProperties();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.datascope.handler.ScopeModelHandler scopeModelHandler(PlatformDataScopeProperties dataScopeProperties) {
return new org.zodiac.datascope.handler.PlatformScopeModelHandler(jdbcTemplate, securityCacheOperations, dataScopeProperties);
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(value = {org.zodiac.datascope.handler.ScopeModelHandler.class})
protected org.zodiac.datascope.handler.DataScopeHandler dataScopeHandler(org.zodiac.datascope.handler.ScopeModelHandler scopeModelHandler) {
return new org.zodiac.datascope.handler.PlatformDataScopeHandler(scopeModelHandler);
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(value = {org.zodiac.datascope.handler.DataScopeHandler.class})
protected org.zodiac.datascope.interceptor.DataScopeInterceptor interceptor(org.zodiac.datascope.handler.DataScopeHandler dataScopeHandler,
PlatformDataScopeProperties dataScopeProperties) {
return new org.zodiac.datascope.interceptor.DataScopeInterceptor(dataScopeHandler, dataScopeProperties, securityAuthOperations);
}
}