We are using weblogic version 12C. Steps to reproduce the issue: -
We need to create either a new datasource everytime or save the datasource setting again.
Can someone please check and let me know if you know some solution for this?
I had the same problem. Adding destroyMethod="" fixed it for me.
Apparently if there is no destroyMethod, Spring tries to determine what the destroy method is. This is apparently causing the datasource to be closed and the JNDI key to be removed from the tree. Changing it to "" forces it to not look for a destroyMethod.
@Bean(destroyMethod = "")
public DataSource dataSource() throws NamingException{
Context context = new InitialContext();
return (DataSource)context.lookup("jdbc.mydatasource");
}