I am trying to set schema to dataSource
object as below in Java based configurations.
@Bean(name = "dataSource")
public DataSource dataSource()
{
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(jdbcURL);
dataSource.setUsername(username);
dataSource.setPassword(password);
Properties connectionProperties = new Properties();
connectionProperties.setProperty("testOnBorrow", "true");
connectionProperties.setProperty("validationQuery", "SELECT 1");
connectionProperties.setProperty("spring.datasource.schema", "schemaname");
dataSource.setConnectionProperties(connectionProperties);
return dataSource;
}
But it doesn't seems to be set as it always searches for tables in public schema. FYI, I am using Spring JDBC and Postgres as database.
Please do help me on above.