|
@@ -94,7 +94,6 @@ public class MybatisMapperRefresh implements Runnable {
|
|
* @param sleepSeconds
|
|
* @param sleepSeconds
|
|
* @param enabled
|
|
* @param enabled
|
|
*/
|
|
*/
|
|
- @Deprecated
|
|
|
|
public MybatisMapperRefresh(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory, int delaySeconds,
|
|
public MybatisMapperRefresh(Resource[] mapperLocations, SqlSessionFactory sqlSessionFactory, int delaySeconds,
|
|
int sleepSeconds, boolean enabled) {
|
|
int sleepSeconds, boolean enabled) {
|
|
this.mapperLocations = mapperLocations.clone();
|
|
this.mapperLocations = mapperLocations.clone();
|
|
@@ -151,24 +150,26 @@ public class MybatisMapperRefresh implements Runnable {
|
|
public void run() {
|
|
public void run() {
|
|
if (fileSet == null) {
|
|
if (fileSet == null) {
|
|
fileSet = new HashSet<>();
|
|
fileSet = new HashSet<>();
|
|
- for (Resource mapperLocation : mapperLocations) {
|
|
|
|
- try {
|
|
|
|
- if (ResourceUtils.isJarURL(mapperLocation.getURL())) {
|
|
|
|
- String key = new UrlResource(ResourceUtils.extractJarFileURL(mapperLocation.getURL()))
|
|
|
|
- .getFile().getPath();
|
|
|
|
- fileSet.add(key);
|
|
|
|
- if (jarMapper.get(key) != null) {
|
|
|
|
- jarMapper.get(key).add(mapperLocation);
|
|
|
|
|
|
+ if (mapperLocations != null) {
|
|
|
|
+ for (Resource mapperLocation : mapperLocations) {
|
|
|
|
+ try {
|
|
|
|
+ if (ResourceUtils.isJarURL(mapperLocation.getURL())) {
|
|
|
|
+ String key = new UrlResource(ResourceUtils.extractJarFileURL(mapperLocation.getURL()))
|
|
|
|
+ .getFile().getPath();
|
|
|
|
+ fileSet.add(key);
|
|
|
|
+ if (jarMapper.get(key) != null) {
|
|
|
|
+ jarMapper.get(key).add(mapperLocation);
|
|
|
|
+ } else {
|
|
|
|
+ List<Resource> resourcesList = new ArrayList<>();
|
|
|
|
+ resourcesList.add(mapperLocation);
|
|
|
|
+ jarMapper.put(key, resourcesList);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- List<Resource> resourcesList = new ArrayList<>();
|
|
|
|
- resourcesList.add(mapperLocation);
|
|
|
|
- jarMapper.put(key, resourcesList);
|
|
|
|
|
|
+ fileSet.add(mapperLocation.getFile().getPath());
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- fileSet.add(mapperLocation.getFile().getPath());
|
|
|
|
|
|
+ } catch (IOException ioException) {
|
|
|
|
+ ioException.printStackTrace();
|
|
}
|
|
}
|
|
- } catch (IOException ioException) {
|
|
|
|
- ioException.printStackTrace();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|