All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.seata.SeataConfigAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.seata;

import javax.sql.DataSource;

import org.springframework.boot.SpringBootConfiguration;
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.autoconfigure.condition.ConditionalOnSingleCandidate;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.*;


@SpringBootConfiguration
@ConditionalOnProperty(name = org.zodiac.seata.constants.SeataSystemPropertiesConstants.SEATA_ENABLED, havingValue = "true")
@ConditionalOnClass(value = {org.zodiac.seata.config.SeataConfigInfo.class, io.seata.spring.boot.autoconfigure.SeataAutoConfiguration.class, io.seata.core.context.ContextCore.class})
public class SeataConfigAutoConfiguration {

    public SeataConfigAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    @ConfigurationProperties(prefix = org.zodiac.seata.constants.SeataSystemPropertiesConstants.SEATA_PREFIX)
    protected SeataConfigProperties seataConfigProperties() {
        return new SeataConfigProperties();
    }

    @Bean
    @Primary
    @ConditionalOnSingleCandidate(value = DataSource.class)
    @ConditionalOnProperty(name = org.zodiac.seata.constants.SeataSystemPropertiesConstants.SEATA_AUTO_PROXY, havingValue = "true")
    protected io.seata.rm.datasource.DataSourceProxy dataSourceProxy(DataSource dataSource) {
        return new io.seata.rm.datasource.DataSourceProxy(dataSource);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy