FAQ_12_陌生的VERSION.SDK_INT

本文介绍了Android中的VERSION.SDK_INT常量,解释了它是如何反映设备所使用的Android版本,并展示了如何利用这个值来实现应用的跨版本兼容性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

看到VERSION.SDK_INT不禁诧异,这是何物?!

看API的定义,如下:

public static final int SDK_INT

Since: API Level 4
The user-visible SDK version of the framework; its possible values are defined in Build.VERSION_CODES.

原来是一个常量值。但是这个常量值可以根据系统的不同而不同哟!为了揭开其神秘的面纱,将源码ctrl如下:

/**
  * The user-visible SDK version of the framework; its possible
  * values are defined in {@link Build.VERSION_CODES}.
  */
  public static final int SDK_INT = SystemProperties.getInt(
               "ro.build.version.sdk", 0);

可以看出,获取系统属性,类似Java中获取系统属性值。

研究一下 SystemProperties 这个类,知道该类没有在API中出现,android并没有开放这个API接口。
VERSION.SDK_INT 常量,在开发过程中还是比较有用的,为了做到平台兼容性,可以使用该值做一些判断,防止API调用过时或者消失。

示例:

int currentVersion = android.os.Build.VERSION.SDK_INT;
if(currentVersion == android.os.Build.VERSION_CODES.ECLAIR_MR1) {
	// 2.1
} else if(currentVersion == android.os.Build.VERSION_CODES.FROYO) {
	// 2.2
} else if(currentVersion == android.os.Build.VERSION_CODES.GINGERBREAD) {
	// 2.3
} else if(currentVersion == android.os.Build.VERSION_CODES.HONEYCOMB) {
	// 3.0
}


还如,判断如果设备不是3.0(平板操作系统)的话,就设置不显示标题:

if (VERSION.SDK_INT != 11) {
      getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}

这些常量位于android.os.Build.VERSION_CODES这个内部类中:



"C:\Program Files\Java\jdk-1.8\bin\java.exe" -Dpandora.location=E:\apache-maven-3.8.1-bin\taobao-hsf.sar-dev-SNAPSHOT.jar -Xmx1g -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:E:\idea\IntelliJ IDEA 2023.2\lib\idea_rt.jar=53638:E:\idea\IntelliJ IDEA 2023.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Lplayer\AppData\Local\Temp\classpath1138593618.jar com.insigma.InsiisWebApplication fail to download http://mvnrepo.alibaba-inc.com/mvn/repository/com/alibaba/citrus/tool/antx-autoconfig/1.2-jdk9/antx-autoconfig-1.2-jdk9.jar to C:\Users\Lplayer\.autoconf\autoconf-1.2-jdk9.jar C:\Users\Lplayer\.autoconf\autoconf-1.2-jdk9.jar doesn't exist. ____ _ ____ _ | _ \ __ _ _ __ __| | ___ _ __ __ _ | __ ) ___ ___ | |_ | |_) / _` | '_ \ / _` |/ _ \| '__/ _` | | _ \ / _ \ / _ \| __| | __/ (_| | | | | (_| | (_) | | | (_| | | |_) | (_) | (_) | |_ |_| \__,_|_| |_|\__,_|\___/|_| \__,_| |____/ \___/ \___/ \__| :: Pandora Boot :: 2.1.9.1 Set log4j.defaultInitOverride to true. JM.Log:INFO Init JM logger with Log4jLoggerFactory JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ JM.Log:INFO Set pandora log path: C:\Users\Lplayer\logs\pandora JM.Log:INFO Init JM logger with Log4jLoggerFactory JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ JM.Log:INFO Set pandora log path: C:\Users\Lplayer\logs\pandora JM.Log:INFO Init JM logger with Log4jLoggerFactory JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ JM.Log:INFO Set pandolet log path: C:\Users\Lplayer\logs\pandolet INFO: spas-client-initializer init Wed Aug 06 09:00:34 CST 2025 spas-sdk-client's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, spas-sdk-client's ModuleClassLoader Wed Aug 06 09:00:34 CST 2025 spas-sdk-client's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:34 CST 2025 spas-sdk-client's ModuleClassLoader JM.Log:INFO Set spas log path: C:\Users\Lplayer\logs\spas Wed Aug 06 09:00:34 CST 2025 eagleeye-core's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, eagleeye-core's ModuleClassLoader Wed Aug 06 09:00:34 CST 2025 eagleeye-core's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:34 CST 2025 eagleeye-core's ModuleClassLoader JM.Log:INFO Set metrics log path: C:\Users\Lplayer\logs\metrics Wed Aug 06 09:00:35 CST 2025 vipserver-client's ModuleClassLoader JM.Log:INFO Init JM logger with Log4jLoggerFactory, vipserver-client's ModuleClassLoader Wed Aug 06 09:00:35 CST 2025 vipserver-client's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:35 CST 2025 vipserver-client's ModuleClassLoader JM.Log:INFO Set vipsrv-logs log path: C:\Users\Lplayer\logs\vipsrv-logs Wed Aug 06 09:00:35 CST 2025 monitor's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, monitor's ModuleClassLoader Wed Aug 06 09:00:35 CST 2025 monitor's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:35 CST 2025 monitor's ModuleClassLoader JM.Log:INFO Set tomcat-monitor log path: C:\Users\Lplayer\logs\tomcat-monitor Wed Aug 06 09:00:35 CST 2025 hsf's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, hsf's ModuleClassLoader Wed Aug 06 09:00:35 CST 2025 hsf's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:35 CST 2025 hsf's ModuleClassLoader JM.Log:INFO Set hsf log path: C:\Users\Lplayer\logs\hsf SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/E:/apache-maven-3.8.1-bin/taobao-hsf.sar-dev-SNAPSHOT.jar!/plugins/hsf!/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/E:/apache-maven-3.8.1-bin/taobao-hsf.sar-dev-SNAPSHOT.jar!/plugins/hsf!/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] *******************HSF PORT:12200 ************** *************Pandora QOS PORT:12201 ************** *************Tomcat Monitor Port:8006 ************** *******************Sentinel PORT:8719 ************** log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. **************************************************************************************** ** ** ** Pandora Container ** ** ** ** Pandora Host: 10.66.242.118 ** ** Pandora Version: 2.1.4 ** ** SAR Version: edas.sar.V3.5.3 ** ** Package Time: 2025-08-06 09:00:32 ** ** ** ** Plug-in Modules: 19 ** ** ** ** metrics .......................................... 1.7.0 ** ** edas-assist ...................................... 2.0 ** ** pandora-qos-service .............................. edas215 ** ** pandolet ......................................... 1.0.0 ** ** spas-sdk-client .................................. 1.3.0 ** ** eagleeye-core .................................... 1.7.10.1 ** ** tddl-driver ...................................... 1.0.5-SNAPSHOT ** ** vipserver-client ................................. 4.7.9-SNAPSHOT ** ** diamond-client ................................... 3.8.10 ** ** configcenter-client .............................. 1.0.3 ** ** spas-sdk-service ................................. 1.3.0 ** ** dpath ............................................ 1.4 ** ** config-client .................................... 1.9.6 ** ** unitrouter ....................................... 1.0.11 ** ** monitor .......................................... 1.2.3-SNAPSHOT ** ** sentinel-plugin .................................. 2.12.12-edas ** ** ons-client ....................................... 1.8.0-EagleEye ** ** hsf .............................................. 2.2.7.3.1-TLS ** ** pandora-framework ................................ 2.0.8 ** ** ** ** [WARNING] All these plug-in modules will override maven pom.xml dependencies. ** ** More: http://gitlab.alibaba-inc.com/middleware-container/pandora/wikis/home ** ** ** **************************************************************************************** INFO: spas-client-initializer start JM.Log:INFO Init JM logger with Log4jLoggerFactory JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ JM.Log:INFO Set pandora log path: C:\Users\Lplayer\logs\pandora Init available components Scanning for available components in the runtime Starting available components Skip ProjectInfoInitializer. 2025-08-06 09:00:37.814 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$dd14cfb2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:00:37.845 INFO 3324 --- [ main] c.a.c.c.acm.AliCloudAcmInitializer : Initialize acm from acm configuration. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.4.RELEASE) Wed Aug 06 09:00:38 CST 2025 diamond-client's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, diamond-client's ModuleClassLoader Wed Aug 06 09:00:38 CST 2025 diamond-client's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:38 CST 2025 diamond-client's ModuleClassLoader JM.Log:INFO Set diamond-client log path: C:\Users\Lplayer\logs\diamond-client 09:00:38.851 [main] INFO c.t.d.identify.CredentialWatcher - [] [] [] No credential found 2025-08-06 09:00:38.961 INFO 3324 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='diamond', propertySources=[]} Skip ProjectInfoInitializer. 2025-08-06 09:00:38.981 INFO 3324 --- [ main] com.insigma.InsiisWebApplication : The following profiles are active: redis,datasource,security,mybatis,async 2025-08-06 09:00:42.299 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2025-08-06 09:00:42.299 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode. 2025-08-06 09:00:42.810 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 503ms. Found 21 repository interfaces. 2025-08-06 09:00:42.817 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2025-08-06 09:00:42.817 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode. 2025-08-06 09:00:42.981 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.Aa26Repository. 2025-08-06 09:00:42.982 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.MenuRepository. 2025-08-06 09:00:42.982 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.RoleRepository. 2025-08-06 09:00:42.983 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysCodeRepository. 2025-08-06 09:00:42.983 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysErrorRepository. 2025-08-06 09:00:42.983 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysHolidayRepository. 2025-08-06 09:00:42.983 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysIdMappingRespository. 2025-08-06 09:00:42.984 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysOrgRepository. 2025-08-06 09:00:42.984 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysRoleFunctionRepository. 2025-08-06 09:00:42.984 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserAreaRepository. 2025-08-06 09:00:42.985 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserRepository. 2025-08-06 09:00:42.986 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserRoleRepository. 2025-08-06 09:00:42.986 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.drugs.repository.ProtalDrugsRepository. 2025-08-06 09:00:42.986 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.framework.oplog.repository.OpLogRepository. 2025-08-06 09:00:42.986 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.framework.commons.repository.SysOperateLogRepository. 2025-08-06 09:00:42.987 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.framework.oplog.repository.OpLogFormRepository. 2025-08-06 09:00:42.987 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.Aa01Repository. 2025-08-06 09:00:42.989 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.CodeTypeRepository. 2025-08-06 09:00:42.989 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.MdParamRepository. 2025-08-06 09:00:42.989 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.framework.web.securities.repository.SysLogonLogRepository. 2025-08-06 09:00:43.026 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data MongoDB - Could not safely identify store assignment for repository candidate interface com.insigma.framework.web.securities.repository.SysLogonLogRepository. 2025-08-06 09:00:43.027 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 210ms. Found 0 repository interfaces. 2025-08-06 09:00:43.038 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2025-08-06 09:00:43.039 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode. 2025-08-06 09:00:43.205 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.Aa26Repository. 2025-08-06 09:00:43.205 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.MenuRepository. 2025-08-06 09:00:43.205 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.RoleRepository. 2025-08-06 09:00:43.205 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysCodeRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysErrorRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysHolidayRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysIdMappingRespository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysOrgRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysRoleFunctionRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserAreaRepository. 2025-08-06 09:00:43.206 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.sys.repository.SysUserRoleRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.drugs.repository.ProtalDrugsRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.framework.oplog.repository.OpLogRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.framework.commons.repository.SysOperateLogRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.framework.oplog.repository.OpLogFormRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.Aa01Repository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.CodeTypeRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.web.support.dao.MdParamRepository. 2025-08-06 09:00:43.207 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.framework.web.securities.repository.SysLogonLogRepository. 2025-08-06 09:00:43.231 INFO 3324 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.insigma.framework.web.securities.repository.SysLogonLogRepository. 2025-08-06 09:00:43.231 INFO 3324 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 184ms. Found 0 repository interfaces. 2025-08-06 09:00:43.414 WARN 3324 --- [ main] o.m.s.mapper.ClassPathMapperScanner : Skipping MapperFactoryBean with name 'caseInfoDDao' and 'com.insigma.business.bigdata.dao.CaseInfoDDao' mapperInterface. Bean already defined with the same name! 2025-08-06 09:00:43.515 INFO 3324 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=715b0589-9638-3765-9a2d-50e339059fc9 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "queryAdmdvsService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "queryDataDicService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "roleAuthInfoService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "admrolService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "orguntService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "unitService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "userService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "sysUactService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "resuService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "bizrolService" in spring context. 2025-08-06 09:00:43.637 INFO 3324 --- [ main] c.a.b.h.c.HsfConsumerPostProcessor : registered HSFConsumerBean "publicFeedetlChkDetMgtService" in spring context. Wed Aug 06 09:00:43 CST 2025 dpath's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, dpath's ModuleClassLoader Wed Aug 06 09:00:43 CST 2025 dpath's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ Wed Aug 06 09:00:43 CST 2025 dpath's ModuleClassLoader JM.Log:INFO Set dpath log path: C:\Users\Lplayer\logs\dpath Wed Aug 06 09:00:43 CST 2025 dpath's ModuleClassLoader JM.Log:INFO Can't find method for class ch.qos.logback.classic.AsyncAppender setMaxFlushTime 3000 Wed Aug 06 09:00:43 CST 2025 dpath's ModuleClassLoader JM.Log:INFO Can't find method for class ch.qos.logback.classic.AsyncAppender setNeverBlock true Wed Aug 06 09:00:46 CST 2025 config-client's ModuleClassLoader JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, config-client's ModuleClassLoader Wed Aug 06 09:00:46 CST 2025 config-client's ModuleClassLoader JM.Log:INFO Log root path: C:\Users\Lplayer\logs\ 09:00:46.888 [HSF-Framework-ExportRefer-14-thread-1] INFO ConfigClientLogger - [] [] [] JM_CC_LOG_RETAIN_COUNT:6, JM_LOG_FILE_SIZE:200MB Wed Aug 06 09:00:46 CST 2025 config-client's ModuleClassLoader JM.Log:INFO Set configclient log path: C:\Users\Lplayer\logs\configclient 2025-08-06 09:00:49.973 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'queryAdmdvsService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:00:52.994 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'queryDataDicService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:00:56.018 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'roleAuthInfoService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:00:59.040 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'admrolService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:02.062 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'orguntService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:05.082 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'unitService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:08.103 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'userService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:11.121 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sysUactService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:14.146 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'resuService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:17.170 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'bizrolService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.193 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'publicFeedetlChkDetMgtService' of type [com.taobao.hsf.app.spring.util.HSFSpringConsumerBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.270 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$c0faccb5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.378 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'redisConfig' of type [com.insigma.web.support.redis.RedisConfig$$EnhancerBySpringCGLIB$$20be0ef0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.401 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'multipleDataSourceConfig' of type [com.insigma.hsaf.common.config.MultipleDataSourceConfig$$EnhancerBySpringCGLIB$$1e06f17d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.432 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.475 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.druid.spring.boot.autoconfigure.stat.DruidFilterConfiguration' of type [com.alibaba.druid.spring.boot.autoconfigure.stat.DruidFilterConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.492 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'statFilter' of type [com.alibaba.druid.filter.stat.StatFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.597 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'wallConfig' of type [com.alibaba.druid.wall.WallConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.616 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'wallFilter' of type [com.alibaba.druid.wall.WallFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:20.676 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'slf4jLogFilter' of type [com.alibaba.druid.filter.logging.Slf4jLogFilter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) Wed Aug 06 09:01:20 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:20 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:20 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:20 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:21 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2025-08-06 09:01:21.030 INFO 3324 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited 2025-08-06 09:01:21.030 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'primaryDataSource' of type [com.insigma.hsaf.common.config.MultipleDataSourceConfig$DruidDataSourceWrapper] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.074 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.086 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.jdbc-org.springframework.boot.autoconfigure.jdbc.JdbcProperties' of type [org.springframework.boot.autoconfigure.jdbc.JdbcProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.087 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration$JdbcTemplateConfiguration' of type [org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration$JdbcTemplateConfiguration$$EnhancerBySpringCGLIB$$d985fb22] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.097 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jdbcTemplate' of type [org.springframework.jdbc.core.JdbcTemplate] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.117 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'odinLogServiceImpl' of type [com.insigma.framework.log.service.impl.OdinLogServiceImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.136 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'odinLogAspect' of type [com.insigma.framework.log.OdinLogAspect] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.144 INFO 3324 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$dd14cfb2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-08-06 09:01:21.458 INFO 3324 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9100 (http) 八月 06, 2025 9:01:21 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-9100"] log4j:WARN No appenders could be found for logger (org.apache.coyote.http11.Http11NioProtocol). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Tomcat] 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet engine: [Apache Tomcat/9.0.17] 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: Loaded APR based Apache Tomcat Native library [1.3.1] using APR version [1.7.4]. 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized [OpenSSL 3.0.14 4 Jun 2024] 八月 06, 2025 9:01:21 上午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring embedded WebApplicationContext 2025-08-06 09:01:21.555 INFO 3324 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 42560 ms 2025-08-06 09:01:21.567 INFO 3324 --- [ main] c.i.f.system.safety.SysSafetyProperties : sql: SysSafetyProperties.SQL(badstr=null) System is starting! UTF-8:一个汉字的字节数为:3 2025-08-06 09:01:22.651 INFO 3324 --- [ main] c.i.o.f.safe.validate.SignatureValidate : li: anytomcat2023-03-04anyunlimitedinsiisunlimited安徽省医保核心配置文件anyWindowsTf-c4-d3-UZ-d3-1646357567308502[][]10安徽省医保(核三框架)DEVELOP[{}]rule=0, version=6.0delay=0, extend=, format=2, product=insiis, release=1.0 2025-08-06 09:01:22.652 INFO 3324 --- [ main] c.i.o.f.safe.validate.SignatureValidate : 9180cd3c218c8736c1a23333546bff22f4017978 2025-08-06 09:01:22.666 INFO 3324 --- [ main] c.i.o.f.safe.ValidateContExecute : Apache Tomcat/9.0.17 您的核心配置文件已经失效测!请及时更换。Your core config have expired! Please update it! 2025-08-06 09:01:23.038 INFO 3324 --- [ main] c.i.o.f.safe.ValidateContExecute : IP: [127.0.0.1, 0:0:0:0:0:0:0:1, fe80:0:0:0:cb88:c7b3:57ec:13b3%eth3, fe80:0:0:0:6d46:2122:72d0:9648%eth4, 10.66.242.118, fe80:0:0:0:b0b9:6640:37a:c4b2%eth5, fe80:0:0:0:83dc:74e7:38e:235b%eth7, fe80:0:0:0:fc5c:c0e0:f227:7889%wlan0, 192.168.18.1, fe80:0:0:0:b714:55b0:2962:c0f2%eth9, 192.168.163.1, fe80:0:0:0:d554:a3f0:a6ea:47d3%eth10, fe80:0:0:0:aed2:bc06:dc31:db57%wlan1, 192.168.83.243, 240e:45a:48d:67c2:6dbd:62cf:5eda:307c, 240e:45a:48d:67c2:fddf:2d50:d7db:573f, fe80:0:0:0:2dc6:6f4:b194:de03%wlan2] 2025-08-06 09:01:23.038 INFO 3324 --- [ main] c.i.o.f.safe.ValidateContExecute : CPU core: 20 2025-08-06 09:01:23.039 INFO 3324 --- [ main] c.i.o.f.safe.ValidateContExecute : Windows 11 10.0 2025-08-06 09:01:23.100 INFO 3324 --- [ main] c.i.o.f.safe.ValidateContExecute : Computer MAC: [] 2025-08-06 09:01:23.409 INFO 3324 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2025-08-06 09:01:23.476 INFO 3324 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final} 2025-08-06 09:01:23.478 INFO 3324 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2025-08-06 09:01:23.479 INFO 3324 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2025-08-06 09:01:23.522 INFO 3324 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2025-08-06 09:01:23.613 INFO 3324 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 2025-08-06 09:01:23.775 WARN 3324 --- [ main] org.hibernate.id.UUIDHexGenerator : HHH000409: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead 2025-08-06 09:01:24.127 INFO 3324 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2025-08-06 09:01:25.142 INFO 3324 --- [ main] io.lettuce.core.EpollProvider : Starting without optional epoll library 2025-08-06 09:01:25.143 INFO 3324 --- [ main] io.lettuce.core.KqueueProvider : Starting without optional kqueue library 2025-08-06 09:01:26.137 INFO 3324 --- [ main] c.i.h.c.a.cache.AdmdvsDimCacheManager : init admdvsDim Start 2025-08-06 09:01:27.066 INFO 3324 --- [ main] c.i.h.c.a.cache.AdmdvsDimCacheManager : init admdvsDim End 2025-08-06 09:01:27.635 INFO 3324 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory 2025-08-06 09:01:27.993 INFO 3324 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-2} inited 2025-08-06 09:01:28.092 INFO 3324 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static boolean com.insigma.sys.common.SysManageMode.tripleMode 2025-08-06 09:01:28.136 INFO 3324 --- [ main] com.insigma.sys.config.UEditorConfig : 读取UEditor配置文件成功! 2025-08-06 09:01:28.808 INFO 3324 --- [ main] c.i.hsa.common.base.job.CacheRefreshJob : begin refresh enforce dict cache ... 2025-08-06 09:01:28.809 INFO 3324 --- [ main] c.i.hsa.common.base.job.CacheRefreshJob : success refresh enforce dict cache ... 2025-08-06 09:01:28.809 INFO 3324 --- [ main] c.i.hsa.common.base.job.CacheRefreshJob : begin refresh enforce admdvsDim cache ... 2025-08-06 09:01:28.815 INFO 3324 --- [ main] c.i.h.c.a.cache.AdmdvsDimCacheManager : init admdvsDim Start 2025-08-06 09:01:29.615 INFO 3324 --- [ main] c.i.h.c.a.cache.AdmdvsDimCacheManager : init admdvsDim End 2025-08-06 09:01:29.615 INFO 3324 --- [ main] c.i.hsa.common.base.job.CacheRefreshJob : success refresh enforce admdvsDim cache ... 2025-08-06 09:01:29.627 INFO 3324 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static methods: public static void com.insigma.hsa.common.excel.ExcelUtils.setPageSize(int) 2025-08-06 09:01:29.735 WARN 3324 --- [ main] c.i.framework.GlobalExceptionCollector : 没有找到公共服务异常统一管理方法[call4Exception],该功能将自动关闭! 2025-08-06 09:01:30.454 INFO 3324 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2025-08-06 09:01:30.519 WARN 3324 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter. 2025-08-06 09:01:31.239 INFO 3324 --- [ main] .s.s.UserDetailsServiceAutoConfiguration : Using generated security password: f0640dd2-67b8-4024-bdd5-51708f0024e3 2025-08-06 09:01:31.321 INFO 3324 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@34fd82cd, org.springframework.security.web.context.SecurityContextPersistenceFilter@18010665, org.springframework.security.web.header.HeaderWriterFilter@2e41e742, org.springframework.security.web.authentication.logout.LogoutFilter@203b2f14, com.insigma.hsaf.security.web.support.SSOUserContextFilter@28d38918, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@19f1d1d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2a5b5e33, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@14029881, org.springframework.security.web.session.SessionManagementFilter@307d7688, org.springframework.security.web.access.ExceptionTranslationFilter@5e09b1a6, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@ddbbb82] 2025-08-06 09:01:31.325 INFO 3324 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1925b878, org.springframework.security.web.context.SecurityContextPersistenceFilter@e449c7c, org.springframework.security.web.header.HeaderWriterFilter@4464aae2, org.springframework.security.web.authentication.logout.LogoutFilter@247dd07, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@112d42ba, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@707fc9c7, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7f9b0fb, org.springframework.security.web.session.SessionManagementFilter@238a281f, org.springframework.security.web.access.ExceptionTranslationFilter@63ff8137, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@61a5226d] 2025-08-06 09:01:32.445 INFO 3324 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 7099 (http) 2025-08-06 09:01:32.451 INFO 3324 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 81 ms 八月 06, 2025 9:01:32 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-7099"] 八月 06, 2025 9:01:32 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Tomcat] 八月 06, 2025 9:01:32 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet engine: [Apache Tomcat/9.0.17] 八月 06, 2025 9:01:32 上午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring embedded WebApplicationContext 2025-08-06 09:01:32.465 INFO 3324 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator' 2025-08-06 09:01:32.501 INFO 3324 --- [ool-20-thread-1] c.i.h.c.d.impl.DataDicLocalServiceImpl : DataDicLocalServiceImpl---------getDataDict--------start 八月 06, 2025 9:01:32 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-nio-7099"] 2025-08-06 09:01:32.541 INFO 3324 --- [ool-20-thread-1] c.i.h.c.d.impl.DataDicLocalServiceImpl : 配置的字典编码.size=0 2025-08-06 09:01:32.557 INFO 3324 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 7099 (http) with context path '' 2025-08-06 09:01:32.574 INFO 3324 --- [ool-20-thread-1] c.i.hsa.common.dict.DataDictManager : 加载字典数=1160 2025-08-06 09:01:33.165 INFO 3324 --- [ main] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing 2025-08-06 09:01:33.173 INFO 3324 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9100 (http) with context path '/insiis7-enforce' 2025-08-06 09:01:33.175 INFO 3324 --- [ main] com.insigma.InsiisWebApplication : Started InsiisWebApplication in 57.123 seconds (JVM running for 67.713) 八月 06, 2025 9:01:33 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-nio-9100"] 2025-08-06 09:01:33.205 INFO 3324 --- [ main] c.i.b.send.server.init.InitServer : 初始化结果en:false Service(pandora boot) startup in 61482 ms 2025-08-06 09:01:33.786 INFO 3324 --- [ool-21-thread-1] c.i.h.c.region.service.PoolareaManager : 加载统筹区数据! 2025-08-06 09:01:33.908 INFO 3324 --- [ool-21-thread-1] c.i.h.c.region.service.PoolareaManager : 加载和缓存所有统筹区完毕!queryResult.size=4478 2025-08-06 09:01:33.943 INFO 3324 --- [ool-21-thread-1] c.i.h.c.region.service.PoolareaManager : 加载统筹区数据完毕!highest.size=469,groupResult.size=373 Wed Aug 06 09:01:34 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 八月 06, 2025 9:01:34 上午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring DispatcherServlet 'dispatcherServlet' 2025-08-06 09:01:34.244 INFO 3324 --- [)-10.66.242.118] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2025-08-06 09:01:34.256 INFO 3324 --- [)-10.66.242.118] o.s.web.servlet.DispatcherServlet : Completed initialization in 12 ms Wed Aug 06 09:01:34 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:34 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:34 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Aug 06 09:01:34 CST 2025 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2025-08-06 09:01:34.363 INFO 3324 --- [)-10.66.242.118] com.alibaba.druid.pool.DruidDataSource : {dataSource-3} inited 2025-08-06 09:01:35.750 INFO 3324 --- [ool-21-thread-1] c.i.h.c.admdvs.bo.impl.AdmdvsBOImpl : 加载行政区划数据... 2025-08-06 09:01:35.778 INFO 3324 --- [ool-21-thread-1] c.i.h.c.admdvs.bo.impl.AdmdvsBOImpl : 行政区划数据缓存完毕!省份数=1,地市数=1,区县数=17 2025-08-06 09:04:28.806 INFO 3324 --- [nio-9100-exec-9] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:28.806 INFO 3324 --- [nio-9100-exec-3] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:28.806 INFO 3324 --- [nio-9100-exec-1] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:28.829 INFO 3324 --- [nio-9100-exec-9] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== 2025-08-06 09:04:28.829 INFO 3324 --- [nio-9100-exec-3] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== 2025-08-06 09:04:28.830 INFO 3324 --- [nio-9100-exec-1] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== Hibernate: select sysmenu0_.functionid as function1_7_, sysmenu0_.active as active2_7_, sysmenu0_.auflag as auflag3_7_, sysmenu0_.description as descript4_7_, sysmenu0_.developer as develope5_7_, sysmenu0_.digest as digest6_7_, sysmenu0_.funcode as funcode7_7_, sysmenu0_.funorder as funorder8_7_, sysmenu0_.funtype as funtype9_7_, sysmenu0_.icon as icon10_7_, sysmenu0_.idpath as idpath11_7_, sysmenu0_.islog as islog12_7_, sysmenu0_.location as locatio13_7_, sysmenu0_.nodetype as nodetyp14_7_, sysmenu0_.parentid as parenti15_7_, sysmenu0_.rbflag as rbflag16_7_, sysmenu0_.slevel as slevel17_7_, sysmenu0_.title as title18_7_ from SYSFUNCTION sysmenu0_ order by sysmenu0_.funorder 2025-08-06 09:04:31.567 INFO 3324 --- [nio-9100-exec-2] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:31.569 INFO 3324 --- [nio-9100-exec-2] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== Hibernate: select sysmenu0_.functionid as function1_7_, sysmenu0_.active as active2_7_, sysmenu0_.auflag as auflag3_7_, sysmenu0_.description as descript4_7_, sysmenu0_.developer as develope5_7_, sysmenu0_.digest as digest6_7_, sysmenu0_.funcode as funcode7_7_, sysmenu0_.funorder as funorder8_7_, sysmenu0_.funtype as funtype9_7_, sysmenu0_.icon as icon10_7_, sysmenu0_.idpath as idpath11_7_, sysmenu0_.islog as islog12_7_, sysmenu0_.location as locatio13_7_, sysmenu0_.nodetype as nodetyp14_7_, sysmenu0_.parentid as parenti15_7_, sysmenu0_.rbflag as rbflag16_7_, sysmenu0_.slevel as slevel17_7_, sysmenu0_.title as title18_7_ from SYSFUNCTION sysmenu0_ order by sysmenu0_.funorder 2025-08-06 09:04:31.570 INFO 3324 --- [nio-9100-exec-6] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:31.570 INFO 3324 --- [io-9100-exec-10] c.i.h.s.w.support.SSOUserContextFilter : in SSOUserContextFilter! securitytype is hsa-sso-mock 2025-08-06 09:04:31.572 INFO 3324 --- [io-9100-exec-10] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== 2025-08-06 09:04:31.572 INFO 3324 --- [nio-9100-exec-6] c.i.f.w.s.web.RepeatRequestFilter : ===repeat=false=== 为什么运行不结束
最新发布
08-07
<think>我们正在分析一个Java Spring Boot应用启动后未结束运行的问题。根据Spring Boot的特性,应用启动后应该会保持运行状态(例如,作为Web应用等待HTTP请求),但有时我们期望应用执行完某些任务后自动退出,而它却没有退出。或者,在某些情况下,应用因为某些原因而无法正常退出。 可能的原因及解决方案: 1. **有非守护线程在运行**:Spring Boot应用启动后,如果存在用户创建的线程(非守护线程),那么即使主线程结束,这些线程也会阻止JVM退出。 - 解决方案:检查代码中是否创建了线程,并确保这些线程设置为守护线程(通过`setDaemon(true)`),或者确保在应用结束时能够正确关闭这些线程。 2. **存在未关闭的资源**:例如数据库连接池、文件句柄等资源未正确关闭,可能导致JVM无法退出。 - 解决方案:确保在应用结束时关闭所有资源。可以使用`@PreDestroy`注解的方法来执行清理工作。 3. **Web服务器未关闭**:如果应用是一个Web应用,Spring Boot默认会启动一个内嵌的Web服务器(如Tomcat),它会一直运行以等待HTTP请求。 - 解决方案:如果希望应用执行完某些任务后退出,不要将应用作为Web应用启动(即排除Web依赖)。或者,在任务执行完毕后主动关闭应用上下文。 - 例如,通过注入`ApplicationContext`并调用`close()`方法: ```java @Autowired private ApplicationContext context; public void afterStartup() { // 执行任务 context.close(); } ``` 4. **使用了`SpringApplication`但没有调用`exit`**:如果通过`SpringApplication.run()`启动应用,并且希望在某些条件满足后退出,需要显式地调用`SpringApplication.exit()`。 - 解决方案:获取`ApplicationContext`后,调用`SpringApplication.exit(context, () -> 0)`。 5. **等待外部信号或条件**:应用可能处于等待状态,比如等待某个条件满足、等待消息队列的消息等。 - 解决方案:检查应用逻辑,确保在需要退出时能够正确触发退出流程。 6. **死锁或无限循环**:代码中可能存在死锁或无限循环,导致应用无法退出。 - 解决方案:检查代码,尤其是多线程和循环部分,确保有正确的退出条件。 7. **使用了`@EventListener`监听`ApplicationReadyEvent`但未结束**:在监听启动事件的方法中,如果执行了长时间运行的任务(如轮询任务),并且没有在后台线程中执行,则该方法不会返回,导致应用无法继续执行后续的关闭逻辑(如果有关闭计划的话)。但通常这不会阻止应用保持运行,因为事件监听是在启动过程中执行的。不过,如果在这个方法中启动了非守护线程,就会导致问题。 - 解决方案:对于长时间运行的任务,确保在单独的线程中执行,并且根据需求设置是否为守护线程。 8. **Spring Boot Actuator的shutdown端点未调用**:如果使用了Actuator,并且希望通过HTTP端点关闭应用,但没有调用`/actuator/shutdown`,则应用不会关闭。 - 解决方案:如果需要通过端点关闭,确保正确配置并调用该端点。 **主动关闭应用的示例:** 如果希望在启动后执行一些任务然后关闭,可以在监听`ApplicationReadyEvent`的事件中执行任务,然后关闭应用: ```java import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; @SpringBootApplication public class MyApp implements ApplicationRunner { private final ConfigurableApplicationContext context; public MyApp(ConfigurableApplicationContext context) { this.context = context; } public static void main(String[] args) { SpringApplication.run(MyApp.class, args); } @Override public void run(ApplicationArguments args) throws Exception { // 执行任务 System.out.println("执行任务..."); // 关闭应用 context.close(); } } ``` 或者使用事件监听: ```java import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; @Component public class AppStartup { private final ConfigurableApplicationContext context; public AppStartup(ConfigurableApplicationContext context) { this.context = context; } @EventListener(ApplicationReadyEvent.class) public void onApplicationReady() { // 执行任务 System.out.println("执行任务..."); // 关闭应用 context.close(); } } ``` **总结:** 应用未结束运行可能是因为有活动线程或资源阻止JVM退出,或者因为应用被设计为持续运行(如Web应用)。根据需求,如果是希望执行完任务后退出,则需要主动关闭应用上下文;如果是非预期的持续运行,则需要检查是否有非守护线程、未关闭的资源或死循环等。 §§相关问题§§ 1. 如何在Spring Boot中优雅地关闭应用? 2. Spring Boot中如何管理后台线程的生命周期? 3. 如何配置Spring Boot应用在执行完命令行任务后自动退出?</think>### Java Spring Boot 应用启动后未结束运行的原因分析及解决方案 Spring Boot 应用启动后未结束运行通常是由于**活动线程/资源未释放**或**应用设计特性**导致的。以下是常见原因及解决方案: --- #### 一、常见原因分析 1. **非守护线程未终止** - 用户创建的线程(如`@Async`任务、线程池)未设置为守护线程(daemon thread),会阻止JVM退出。 - 示例: ```java new Thread(() -> { while (true) {...} // 无限循环的非守护线程 }).start(); ``` 2. **内嵌Web服务器未关闭** - Spring Boot默认启动Tomcat/Jetty等Web服务器,会持续监听端口等待请求(设计如此)[^1]。 - 若应用仅为后台任务(非Web服务),需排除Web依赖。 3. **资源未释放** - 数据库连接池、文件句柄、网络连接等未关闭。 - 如:未正确关闭`DataSource`或`RedisTemplate`连接池。 4. **事件监听阻塞** - 监听`ApplicationReadyEvent`时执行了阻塞操作(如轮询队列),且未在独立线程中运行[^2]。 5. **Spring上下文未关闭** - 未显式调用`context.close()`,导致Bean未触发`@PreDestroy`清理逻辑。 --- #### 二、解决方案 ##### 1. 排除Web依赖(非Web应用) ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </exclusion> </exclusions> </dependency> ``` ##### 2. 主动关闭应用上下文 在任务完成后手动关闭Spring容器: ```java @Component public class TaskRunner implements ApplicationRunner { @Autowired private ConfigurableApplicationContext context; @Override public void run(ApplicationArguments args) { // 执行任务... System.out.println("任务完成,关闭应用"); context.close(); // 触发@PreDestroy和资源释放 } } ``` ##### 3. 正确管理线程 - **设置守护线程**: ```java Thread thread = new Thread(() -> {...}); thread.setDaemon(true); // JVM退出时自动终止 thread.start(); ``` - **使用Spring线程池管理**: ```java @Bean public Executor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setAwaitTerminationSeconds(30); // 等待任务结束时间 executor.setWaitForTasksToCompleteOnShutdown(true); return executor; } ``` ##### 4. 释放资源 在`@PreDestroy`方法中关闭资源: ```java @PreDestroy public void cleanup() { dataSource.close(); // 关闭数据库连接池 redisTemplate.getConnectionFactory().getConnection().close(); // 关闭Redis } ``` ##### 5. 检查阻塞操作 将监听器中的阻塞操作移至独立线程: ```java @EventListener(ApplicationReadyEvent.class) public void onStartup() { new Thread(() -> { while (!Thread.currentThread().isInterrupted()) { // 轮询任务... } }).start(); } ``` --- #### 三、调试建议 1. **检查线程状态**: 使用`jstack <pid>` 或 VisualVM 查看活动线程堆栈。 2. **日志分析**: 启用Spring生命周期日志: ```properties logging.level.org.springframework.context=DEBUG ``` 3. **依赖检查**: 运行`mvn dependency:tree` 排查是否误引入Web依赖。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值