Class DataSourceProperties
java.lang.Object
org.springframework.boot.jdbc.autoconfigure.DataSourceProperties
- All Implemented Interfaces:
Aware, BeanClassLoaderAware, InitializingBean
@ConfigurationProperties("spring.datasource")
public class DataSourceProperties
extends Object
implements BeanClassLoaderAware, InitializingBean
Base class for configuration of a data source.
- Since:
- 4.0.0
- Author:
- Dave Syer, Maciej Walkowiak, Stephane Nicoll, Benedikt Ritter, EddĂș MelĂ©ndez, Scott Frederick
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classXA Specific datasource settings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDetermine the name to used based on this configuration.Determine the driver to use based on this configuration and the environment.Determine the password to use based on this configuration and the environment.Determine the url to use based on this configuration and the environment.Determine the username to use based on this configuration and the environment.Return the configured driver ornullif none was configured.getName()Return the configured password ornullif none was configured.@Nullable Class<? extends DataSource> getType()getUrl()Return the configured url ornullif none was configured.Return the configured username ornullif none was configured.getXa()Initialize aDataSourceBuilderwith the state of this instance.booleanvoidsetBeanClassLoader(ClassLoader classLoader) voidsetDriverClassName(@Nullable String driverClassName) voidsetEmbeddedDatabaseConnection(EmbeddedDatabaseConnection embeddedDatabaseConnection) voidsetGenerateUniqueName(boolean generateUniqueName) voidsetJndiName(@Nullable String jndiName) Allows the DataSource to be managed by the container and obtained through JNDI.voidvoidsetPassword(@Nullable String password) voidsetType(@Nullable Class<? extends DataSource> type) voidvoidsetUsername(@Nullable String username) void
-
Constructor Details
-
DataSourceProperties
public DataSourceProperties()
-
-
Method Details
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception
-
initializeDataSourceBuilder
Initialize aDataSourceBuilderwith the state of this instance.- Returns:
- a
DataSourceBuilderinitialized with the customizations defined on this instance
-
isGenerateUniqueName
public boolean isGenerateUniqueName() -
setGenerateUniqueName
public void setGenerateUniqueName(boolean generateUniqueName) -
getName
-
setName
-
getType
-
setType
-
getDriverClassName
-
setDriverClassName
-
determineDriverClassName
Determine the driver to use based on this configuration and the environment.- Returns:
- the driver to use
-
getUrl
-
setUrl
-
determineUrl
Determine the url to use based on this configuration and the environment.- Returns:
- the url to use
-
determineDatabaseName
-
getUsername
-
setUsername
-
determineUsername
-
getPassword
-
setPassword
-
determinePassword
-
getJndiName
-
setJndiName
-
getEmbeddedDatabaseConnection
-
setEmbeddedDatabaseConnection
-
getClassLoader
-
getXa
-
setXa
-