How to programmatically use Spring's JdbcTemplate?
问题 We use Spring's JdbcTemplate which is configured through Spring config as illustrated below. Is there a way to do this without injecting the data source? I'd like to just create the JdbcTemplate instance programmatically and "initalize" the datasource using TheOracleDS . Our current config: Java class private JdbcTemplate jdbcTemplate; @Resource(name = "myDataSource") public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } Spring config <jee:jndi