I have setup a spring boot (v 1.1.9) application to deploy as a WAR file. And I\'m trying to integrate this web application with an existing data service module (added as a
I am able to connect my Spring-Boot application (deployed in Websphere Application Server 9) to WAS datasource. The following code worked for me, for connecting to DataSource:
@Bean(name = "WASDataSource")
public DataSource WASDataSource() throws Exception {
JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
return dataSourceLookup.getDataSource("DSNAME");
}
@Bean(name = "WASDataSourceJdbcTemplate")
public JdbcTemplate jdbcTemplate_WASDS(@Qualifier("WASDataSource")
DataSource dsDB2) {
return new JdbcTemplate(dsDB2);
}
Note: The name of Datasource "DSNAME" is the name which appears on the UI of Websphere console. You can see that via -> Select Resources > JDBC > Data Sources.
Then I created jdbc template:
@Autowired
@Qualifier("WASDataSourceJdbcTemplate")
private JdbcTemplate db2WASTemplate;`
And running query using the query method works fine :
db2WASTemplate.query()
I did not create any Web.xml or ibm-web-bnd.xml files