diff --git a/src/main/java/cn/lihongjie/coal/runner/InitDataRunner.java b/src/main/java/cn/lihongjie/coal/runner/InitDataRunner.java index 85409cc5..eafa43bc 100644 --- a/src/main/java/cn/lihongjie/coal/runner/InitDataRunner.java +++ b/src/main/java/cn/lihongjie/coal/runner/InitDataRunner.java @@ -25,6 +25,7 @@ import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StopWatch; @Component @Slf4j @@ -59,12 +60,21 @@ public class InitDataRunner implements CommandLineRunner { @Async public void run(String... args) throws Exception { - flyway.migrate(); + StopWatch stopWatch = new StopWatch("InitDataRunner"); + stopWatch.start("flyway.migrate"); + flyway.migrate(); + stopWatch.stop(); + + stopWatch.start("organizationService.initOrGetAdminOrg"); OrganizationEntity e = organizationService.initOrGetAdminOrg(); + stopWatch.stop(); + + stopWatch.start("userService.initOrGetAdminUser"); UserEntity u = userService.initOrGetAdminUser(e); + stopWatch.stop(); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication( @@ -74,20 +84,35 @@ public class InitDataRunner implements CommandLineRunner { try { + stopWatch.start("sysConfigService.initDefault"); sysConfigService.initDefault(); + stopWatch.stop(); + + stopWatch.start("dictionaryService.initDefault"); dictionaryService.initDefault(); + stopWatch.stop(); + + + stopWatch.start("scriptService.initFromResource"); scriptService.initFromResource(); - passwordDictService.initDict(); + stopWatch.stop(); + stopWatch.start("passwordDictService.initDict"); + passwordDictService.initDict(); + stopWatch.stop(); + + stopWatch.start("errorMsgService.initDefault"); errorMsgService.initDefault(); + stopWatch.stop(); } finally { SecurityContextHolder.clearContext(); + log.info(stopWatch.prettyPrint()); } } }