Class ShardingSphereAutoConfiguration

java.lang.Object
org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.EnvironmentAware

@Configuration @ComponentScan("org.apache.shardingsphere.spring.boot.converter") @EnableConfigurationProperties(SpringBootPropertiesConfiguration.class) @ConditionalOnProperty(prefix="spring.shardingsphere", name="enabled", havingValue="true", matchIfMissing=true) public class ShardingSphereAutoConfiguration extends Object implements org.springframework.context.EnvironmentAware
Spring boot starter configuration.
  • Constructor Details

    • ShardingSphereAutoConfiguration

      public ShardingSphereAutoConfiguration()
  • Method Details

    • modeConfiguration

      @Bean public org.apache.shardingsphere.infra.config.mode.ModeConfiguration modeConfiguration()
      Get mode configuration.
      Returns:
      mode configuration
    • shardingSphereDataSource

      @Bean @Conditional(LocalRulesCondition.class) @Autowired(required=false) public DataSource shardingSphereDataSource(org.springframework.beans.factory.ObjectProvider<List<org.apache.shardingsphere.infra.config.RuleConfiguration>> rules, org.springframework.beans.factory.ObjectProvider<org.apache.shardingsphere.infra.config.mode.ModeConfiguration> modeConfig) throws SQLException
      Get ShardingSphere data source bean.
      Parameters:
      rules - rules configuration
      modeConfig - mode configuration
      Returns:
      data source bean
      Throws:
      SQLException - SQL exception
    • dataSource

      @Bean @ConditionalOnMissingBean(javax.sql.DataSource.class) public DataSource dataSource(org.apache.shardingsphere.infra.config.mode.ModeConfiguration modeConfig) throws SQLException
      Get data source bean from registry center.
      Parameters:
      modeConfig - mode configuration
      Returns:
      data source bean
      Throws:
      SQLException - SQL exception
    • transactionTypeScanner

      @Bean public TransactionTypeScanner transactionTypeScanner()
      Create transaction type scanner.
      Returns:
      transaction type scanner
    • setEnvironment

      public final void setEnvironment(org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware