Spring JDBC allows to specify in properties file for PROD:
jdbc.driverClassName = oracle.jdbc.OracleDriver
jdbc.url = jdbc:oracle:thin:@...
and for tests
jdbc.driverClassName = org.h2.Driver
jdbc.url = jdbc:h2:mem:test;INIT=...
Thus it's possible to instantiate needed java.sql.DataSource
instance depends of configuration settings with generic code
@Bean
public DataSource dataSource(
@Value("${jdbc.driverClassName}") String driverClass,
@Value("${jdbc.url}") String url,
@Value("${jdbc.username}") String username,
@Value("${jdbc.password}") String password
) {
DriverManagerDataSource dataSource = new DriverManagerDataSource(url, username, password);
dataSource.setDriverClassName(driverClass);
return dataSource;
}
Is it possible in Spring to configure specific type of java.jms.ConnectionFactory
via driver and URL properties' strings like in Spring JDBC?
Actually, my goal is to use Tibco connection factory for PROD and ActiveMQ for tests.