If you were to make your Cloud Secrets Manager client a Spring Bean, you could inject it in whichever components require these credentials. From there Spring would take care of the rest since the other components could not be instanciated without your client.
So it's not just any credentials- it's the database password that you want to source to be used for the DataSource.
In such case something like this ought to work:
@Bean
DataSource dataSource(DataSourceProperties props,
TheIbmSecretManager sm) {
props.setPassword(sm.getTheDatabasePassword()) ;
return props.initializeDataSourceBuilder().build();
}
of course you don't have to make the secret manager a bean if you don't want to, but if you have other secrets to lookup it could come in handy