org.zodiac.autoconfigure.oss.PlatformOssAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.oss;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.oss.condition.ConditionalOnOssEnabled;
import org.zodiac.autoconfigure.security.condition.ConditionalOnSecurityHttpEnabled;
import org.zodiac.oss.constants.OssSystemPropertiesConstants;
@SpringBootConfiguration
@ConditionalOnOssEnabled
//@ConditionalOnWebApplication
@ConditionalOnSecurityHttpEnabled
@ConditionalOnClass(value = {org.zodiac.oss.config.PlatformOssInfo.class, org.zodiac.security.SecurityAuthOperations.class})
public class PlatformOssAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = OssSystemPropertiesConstants.PLATFORM_OSS_PREFIX, ignoreInvalidFields = true)
protected PlatformOssProperties ossProperties() {
return new PlatformOssProperties();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.oss.rule.OssRule ossRule(PlatformOssProperties ossProperties, org.zodiac.security.SecurityAuthOperations2 securityAuthOperations) {
return new org.zodiac.oss.rule.PlatfotmOssRule(ossProperties.isTenantMode(), securityAuthOperations);
}
}