Class DataSourceProperties
java.lang.Object
org.springframework.boot.autoconfigure.jdbc.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:
- 1.1.0
- Author:
- Dave Syer, Maciej Walkowiak, Stephane Nicoll, Benedikt Ritter, EddĂș MelĂ©ndez, Scott Frederick
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classXA Specific datasource settings.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.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(String driverClassName) voidsetEmbeddedDatabaseConnection(EmbeddedDatabaseConnection embeddedDatabaseConnection) voidsetGenerateUniqueName(boolean generateUniqueName) voidsetJndiName(String jndiName) Allows the DataSource to be managed by the container and obtained through JNDI.voidvoidsetPassword(String password) voidsetType(Class<? extends DataSource> type) voidvoidsetUsername(String username) void
- 
Constructor Details- 
DataSourcePropertiespublic DataSourceProperties()
 
- 
- 
Method Details- 
setBeanClassLoader- Specified by:
- setBeanClassLoaderin interface- BeanClassLoaderAware
 
- 
afterPropertiesSet- Specified by:
- afterPropertiesSetin interface- InitializingBean
- Throws:
- Exception
 
- 
initializeDataSourceBuilderInitialize aDataSourceBuilderwith the state of this instance.- Returns:
- a DataSourceBuilderinitialized with the customizations defined on this instance
 
- 
isGenerateUniqueNamepublic boolean isGenerateUniqueName()
- 
setGenerateUniqueNamepublic void setGenerateUniqueName(boolean generateUniqueName) 
- 
getName
- 
setName
- 
getType
- 
setType
- 
getDriverClassNameReturn the configured driver ornullif none was configured.- Returns:
- the configured driver
- See Also:
 
- 
setDriverClassName
- 
determineDriverClassNameDetermine the driver to use based on this configuration and the environment.- Returns:
- the driver to use
- Since:
- 1.4.0
 
- 
getUrlReturn the configured url ornullif none was configured.- Returns:
- the configured url
- See Also:
 
- 
setUrl
- 
determineUrlDetermine the url to use based on this configuration and the environment.- Returns:
- the url to use
- Since:
- 1.4.0
 
- 
determineDatabaseNameDetermine the name to used based on this configuration.- Returns:
- the database name to use or null
- Since:
- 2.0.0
 
- 
getUsernameReturn the configured username ornullif none was configured.- Returns:
- the configured username
- See Also:
 
- 
setUsername
- 
determineUsernameDetermine the username to use based on this configuration and the environment.- Returns:
- the username to use
- Since:
- 1.4.0
 
- 
getPasswordReturn the configured password ornullif none was configured.- Returns:
- the configured password
- See Also:
 
- 
setPassword
- 
determinePasswordDetermine the password to use based on this configuration and the environment.- Returns:
- the password to use
- Since:
- 1.4.0
 
- 
getJndiName
- 
setJndiNameAllows the DataSource to be managed by the container and obtained through JNDI. TheURL,driverClassName,usernameandpasswordfields will be ignored when using JNDI lookups.- Parameters:
- jndiName- the JNDI name
 
- 
getEmbeddedDatabaseConnection
- 
setEmbeddedDatabaseConnection
- 
getClassLoader
- 
getXa
- 
setXa
 
-