@@ -518,25 +518,28 @@ protected SqlSessionFactory buildSqlSessionFactory() throws Exception {
518
518
this .transactionFactory == null ? new SpringManagedTransactionFactory () : this .transactionFactory ,
519
519
this .dataSource ));
520
520
521
- if (!isEmpty (this .mapperLocations )) {
522
- for (Resource mapperLocation : this .mapperLocations ) {
523
- if (mapperLocation == null ) {
524
- continue ;
525
- }
526
-
527
- try {
528
- XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder (mapperLocation .getInputStream (),
529
- targetConfiguration , mapperLocation .toString (), targetConfiguration .getSqlFragments ());
530
- xmlMapperBuilder .parse ();
531
- } catch (Exception e ) {
532
- throw new NestedIOException ("Failed to parse mapping resource: '" + mapperLocation + "'" , e );
533
- } finally {
534
- ErrorContext .instance ().reset ();
521
+ if (this .mapperLocations != null ) {
522
+ if (this .mapperLocations .length == 0 ) {
523
+ LOGGER .warn (() -> "Property 'mapperLocations' was specified but matching resources are not found." );
524
+ } else {
525
+ for (Resource mapperLocation : this .mapperLocations ) {
526
+ if (mapperLocation == null ) {
527
+ continue ;
528
+ }
529
+ try {
530
+ XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder (mapperLocation .getInputStream (),
531
+ targetConfiguration , mapperLocation .toString (), targetConfiguration .getSqlFragments ());
532
+ xmlMapperBuilder .parse ();
533
+ } catch (Exception e ) {
534
+ throw new NestedIOException ("Failed to parse mapping resource: '" + mapperLocation + "'" , e );
535
+ } finally {
536
+ ErrorContext .instance ().reset ();
537
+ }
538
+ LOGGER .debug (() -> "Parsed mapper file: '" + mapperLocation + "'" );
535
539
}
536
- LOGGER .debug (() -> "Parsed mapper file: '" + mapperLocation + "'" );
537
540
}
538
541
} else {
539
- LOGGER .debug (() -> "Property 'mapperLocations' was not specified or no matching resources found " );
542
+ LOGGER .debug (() -> "Property 'mapperLocations' was not specified. " );
540
543
}
541
544
542
545
return this .sqlSessionFactoryBuilder .build (targetConfiguration );
0 commit comments