springboot 项目启动慢

springboot 启动耗时较长,花费27s,打开debug模式,看时间断层,发现下面内容耗时间较长,请教各位大神避免方法

DEBUG] 2020-09-03 13:44:09.854 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties'
[DEBUG] 2020-09-03 13:44:09.864 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@17695df3'
[DEBUG] 2020-09-03 13:44:09.865 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties'


[DEBUG] 2020-09-03 13:44:15.085 [main] org.springframework.boot.web.servlet.server.DocumentRoot.getArchiveFileDocumentRoot(DocumentRoot.java:82): Code archive: /iotp/s17/dfds/dist_lib/S17-dfds.jar
[DEBUG] 2020-09-03 13:44:15.086 [main] org.springframework.boot.web.servlet.server.DocumentRoot.getExplodedWarFileDocumentRoot(DocumentRoot.java:126): Code archive: /iotp/s17/dfds/dist_lib/S17-dfds.jar

这点信息看不出来啥问题,你要不然把整个日志复制出来看看?

[DEBUG] 2020-09-03 13:44:09.675 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'tomcatWebServerFactoryCustomizer' via factory method to bean named 'environment'
[DEBUG] 2020-09-03 13:44:09.675 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'tomcatWebServerFactoryCustomizer' via factory method to bean named 'server-org.springframework.boot.autoconfigure.web.ServerProperties'
[DEBUG] 2020-09-03 13:44:09.680 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'localeCharsetMappingsCustomizer'
[DEBUG] 2020-09-03 13:44:09.681 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration'
[DEBUG] 2020-09-03 13:44:09.682 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration$$EnhancerBySpringCGLIB$$5695ab2] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.686 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'spring.http-org.springframework.boot.autoconfigure.http.HttpProperties'
[DEBUG] 2020-09-03 13:44:09.695 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration' via constructor to bean named 'spring.http-org.springframework.boot.autoconfigure.http.HttpProperties'
[DEBUG] 2020-09-03 13:44:09.739 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'errorPageCustomizer'
[DEBUG] 2020-09-03 13:44:09.740 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration'
[DEBUG] 2020-09-03 13:44:09.741 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$$EnhancerBySpringCGLIB$$5dc0a995] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.747 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'dispatcherServletRegistration'
[DEBUG] 2020-09-03 13:44:09.748 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration'
[DEBUG] 2020-09-03 13:44:09.750 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration$$EnhancerBySpringCGLIB$$e41bc880] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.754 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties'
[DEBUG] 2020-09-03 13:44:09.765 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration' via constructor to bean named 'spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties'
[DEBUG] 2020-09-03 13:44:09.769 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'multipartConfigElement'
[DEBUG] 2020-09-03 13:44:09.770 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration'
[DEBUG] 2020-09-03 13:44:09.771 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration$$EnhancerBySpringCGLIB$$7459e2bf] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.774 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties'
[DEBUG] 2020-09-03 13:44:09.785 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration' via constructor to bean named 'spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties'
[DEBUG] 2020-09-03 13:44:09.796 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'dispatcherServlet'
[DEBUG] 2020-09-03 13:44:09.796 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration'
[DEBUG] 2020-09-03 13:44:09.797 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration$$EnhancerBySpringCGLIB$$821433d9] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.804 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration' via constructor to bean named 'spring.http-org.springframework.boot.autoconfigure.http.HttpProperties'
[DEBUG] 2020-09-03 13:44:09.804 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration' via constructor to bean named 'spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties'
[DEBUG] 2020-09-03 13:44:09.834 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'dispatcherServletRegistration' via factory method to bean named 'dispatcherServlet'
[DEBUG] 2020-09-03 13:44:09.840 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration' via constructor to bean named 'server-org.springframework.boot.autoconfigure.web.ServerProperties'
[DEBUG] 2020-09-03 13:44:09.841 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration' via constructor to bean named 'dispatcherServletRegistration'
[DEBUG] 2020-09-03 13:44:09.844 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'conventionErrorViewResolver'
[DEBUG] 2020-09-03 13:44:09.845 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration'
[DEBUG] 2020-09-03 13:44:09.846 [main] org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:108): Cannot find '.class' file for class [class org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration$$EnhancerBySpringCGLIB$$72557e35] - unable to determine constructor/method parameter names
[DEBUG] 2020-09-03 13:44:09.854 [main] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:213): Creating shared instance of singleton bean 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties'
[DEBUG] 2020-09-03 13:44:09.864 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@17695df3'
[DEBUG] 2020-09-03 13:44:09.865 [main] org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:775): Autowiring by type from bean name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration' via constructor to bean named 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties'


[DEBUG] 2020-09-03 13:44:15.085 [main] org.springframework.boot.web.servlet.server.DocumentRoot.getArchiveFileDocumentRoot(DocumentRoot.java:82): Code archive: /iotp/s17/dfds/dist_lib/S17-dfds.jar
[DEBUG] 2020-09-03 13:44:15.086 [main] org.springframework.boot.web.servlet.server.DocumentRoot.getExplodedWarFileDocumentRoot(DocumentRoot.java:126): Code archive: /iotp/s17/dfds/dist_lib/S17-dfds.jar
[DEBUG] 2020-09-03 13:44:15.086 [main] org.springframework.boot.web.servlet.server.DocumentRoot.logNoDocumentRoots(DocumentRoot.java:151): None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored.
[INFO ] 2020-09-03 13:44:15.133 [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:90): Tomcat initialized with port(s): 21100 (http)
[INFO ] 2020-09-03 13:44:15.155 [main] org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:173): Initializing ProtocolHandler ["http-nio-21100"]
[INFO ] 2020-09-03 13:44:15.167 [main] org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:173): Starting service [Tomcat]

我就找到这里时间有问题,但是不太理解这一步spring在做什么

我也不知道这为啥卡了好几秒。中间两条的日志的换行,是你自己添加的吗?

对的,我把日志拿出来,换行了好看