From 6fc3a796227ede76d70d04c8fe04826e8207d3a6 Mon Sep 17 00:00:00 2001 From: linyimin Date: Wed, 2 Aug 2023 19:41:26 +0800 Subject: [PATCH] Update IocContainer.java --- .../linyimin0812/profiler/core/container/IocContainer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-profiler-core/src/main/java/io/github/linyimin0812/profiler/core/container/IocContainer.java b/spring-profiler-core/src/main/java/io/github/linyimin0812/profiler/core/container/IocContainer.java index 436c7ec..026d70d 100644 --- a/spring-profiler-core/src/main/java/io/github/linyimin0812/profiler/core/container/IocContainer.java +++ b/spring-profiler-core/src/main/java/io/github/linyimin0812/profiler/core/container/IocContainer.java @@ -140,9 +140,14 @@ private static void acquireNumOfBean(List beanInitResultList) { } public static void copyFile(String sourceFilePath, String targetFilePath) throws IOException { - Path sourcePath = Paths.get(sourceFilePath); + Path targetPath = Paths.get(targetFilePath); + // delete target file to avoid FileAlreadyExistsException + Files.deleteIfExists(targetPath); + + Path sourcePath = Paths.get(sourceFilePath); + Files.copy(sourcePath, targetPath); } }