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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataSource(org.apache.shardingsphere.infra.config.mode.ModeConfiguration modeConfig) Get data source bean from registry center.org.apache.shardingsphere.infra.config.mode.ModeConfigurationGet mode configuration.final voidsetEnvironment(org.springframework.core.env.Environment environment) 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) Get ShardingSphere data source bean.Create transaction type scanner.
-
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 configurationmodeConfig- 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
Create transaction type scanner.- Returns:
- transaction type scanner
-
setEnvironment
public final void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-