diff --git a/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java b/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java index d5016f1ad1..73806bcb70 100644 --- a/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java +++ b/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 the original author or authors. + * Copyright 2010-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,6 @@ import org.springframework.context.ApplicationListener; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.NestedIOException; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; @@ -82,6 +81,7 @@ * @author Eduardo Macarron * @author EddĂș MelĂ©ndez * @author Kazuki Shimizu + * @author Jens Schauder * * @see #setConfigLocation * @see #setDataSource @@ -576,7 +576,7 @@ protected SqlSessionFactory buildSqlSessionFactory() throws Exception { try { targetConfiguration.setDatabaseId(this.databaseIdProvider.getDatabaseId(this.dataSource)); } catch (SQLException e) { - throw new NestedIOException("Failed getting a databaseId", e); + throw new IOException("Failed getting a databaseId", e); } } @@ -587,7 +587,7 @@ protected SqlSessionFactory buildSqlSessionFactory() throws Exception { xmlConfigBuilder.parse(); LOGGER.debug(() -> "Parsed configuration file: '" + this.configLocation + "'"); } catch (Exception ex) { - throw new NestedIOException("Failed to parse config resource: " + this.configLocation, ex); + throw new IOException("Failed to parse config resource: " + this.configLocation, ex); } finally { ErrorContext.instance().reset(); } @@ -610,7 +610,7 @@ protected SqlSessionFactory buildSqlSessionFactory() throws Exception { targetConfiguration, mapperLocation.toString(), targetConfiguration.getSqlFragments()); xmlMapperBuilder.parse(); } catch (Exception e) { - throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'", e); + throw new IOException("Failed to parse mapping resource: '" + mapperLocation + "'", e); } finally { ErrorContext.instance().reset(); }