mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 14:40:00 +00:00
Improve JNDI detection logic
Update JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable() to call `getEnvironment()` on the `InitialContext` in order to actually trigger a NamingException if JNDI is not available. Issue: SPR-12223
This commit is contained in:
@@ -58,7 +58,7 @@ public class JndiLocatorDelegate extends JndiLocatorSupport {
|
||||
*/
|
||||
public static boolean isDefaultJndiEnvironmentAvailable() {
|
||||
try {
|
||||
new InitialContext();
|
||||
new InitialContext().getEnvironment();
|
||||
return true;
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
|
||||
Reference in New Issue
Block a user