From 1df5bcd86ac0aafc26c6884e678f231606d81d4b Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sun, 11 Aug 2024 16:43:34 -0400 Subject: [PATCH] [cleanup] More cleanup --- .../java/org/mybatis/spring/SqlSessionFactoryBean.java | 7 +++---- .../mybatis/spring/annotation/MapperScannerRegistrar.java | 1 + .../org/mybatis/spring/mapper/MapperScannerConfigurer.java | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java b/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java index 282bbdf333..ed97f2e130 100644 --- a/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java +++ b/src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java @@ -555,11 +555,10 @@ private T[] appendArrays(T[] oldArrays, T[] newArrays, IntFunction gene } if (newArrays == null) { return oldArrays; - } else { - List newList = new ArrayList<>(Arrays.asList(oldArrays)); - newList.addAll(Arrays.asList(newArrays)); - return newList.toArray(generator.apply(0)); } + List newList = new ArrayList<>(Arrays.asList(oldArrays)); + newList.addAll(Arrays.asList(newArrays)); + return newList.toArray(generator.apply(0)); } @Override diff --git a/src/main/java/org/mybatis/spring/annotation/MapperScannerRegistrar.java b/src/main/java/org/mybatis/spring/annotation/MapperScannerRegistrar.java index f1de1b3c1e..66d4b9f418 100644 --- a/src/main/java/org/mybatis/spring/annotation/MapperScannerRegistrar.java +++ b/src/main/java/org/mybatis/spring/annotation/MapperScannerRegistrar.java @@ -61,6 +61,7 @@ */ public class MapperScannerRegistrar implements ImportBeanDefinitionRegistrar, ResourceLoaderAware { + // Note: Do not move resourceLoader via cleanup private ResourceLoader resourceLoader; @Override diff --git a/src/main/java/org/mybatis/spring/mapper/MapperScannerConfigurer.java b/src/main/java/org/mybatis/spring/mapper/MapperScannerConfigurer.java index eaf7c6f3b1..dd2146308f 100644 --- a/src/main/java/org/mybatis/spring/mapper/MapperScannerConfigurer.java +++ b/src/main/java/org/mybatis/spring/mapper/MapperScannerConfigurer.java @@ -468,11 +468,11 @@ private String getPropertyValue(String propertyName, PropertyValues values) { } if (value instanceof String) { return value.toString(); - } else if (value instanceof TypedStringValue) { + } + if (value instanceof TypedStringValue) { return ((TypedStringValue) value).getValue(); - } else { - return null; } + return null; } @SuppressWarnings("unchecked")