@Configuration
@ComponentScan(value="org.apache.shardingsphere.spring.boot.converter")
@EnableConfigurationProperties(value={SpringBootShardingRuleConfigurationProperties.class,SpringBootMasterSlaveRuleConfigurationProperties.class,SpringBootEncryptRuleConfigurationProperties.class,SpringBootPropertiesConfigurationProperties.class})
@ConditionalOnProperty(prefix="spring.shardingsphere",
name="enabled",
havingValue="true",
matchIfMissing=true)
public class SpringBootConfiguration
extends Object
implements org.springframework.context.EnvironmentAware
| Constructor and Description |
|---|
SpringBootConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
DataSource |
encryptDataSource()
Get encrypt data source bean.
|
DataSource |
masterSlaveDataSource()
Get master-slave data source bean.
|
void |
setEnvironment(org.springframework.core.env.Environment environment) |
DataSource |
shardingDataSource()
Get sharding data source bean.
|
@Bean @Conditional(value=ShardingRuleCondition.class) public DataSource shardingDataSource() throws SQLException
SQLException - SQL exception@Bean @Conditional(value=MasterSlaveRuleCondition.class) public DataSource masterSlaveDataSource() throws SQLException
SQLException - SQL exception@Bean @Conditional(value=EncryptRuleCondition.class) public DataSource encryptDataSource() throws SQLException
SQLException - SQL exceptionpublic final void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment in interface org.springframework.context.EnvironmentAwareCopyright © 2020 The Apache Software Foundation. All rights reserved.