springboot升級到2.6.x和2.7.x 相容hystrix

来源:https://www.cnblogs.com/chenmingming0225/p/17980039
-Advertisement-
Play Games

一、pom.xml需要引入的依賴二、項目開啟熔斷器開關 2.1 註解方式 2.2 xml方式三、依賴類缺失問題四、版本匹配安全檢查問題五、測試驗證六、結論 一、pom.xml需要引入的依賴 pom.xml <!-- springboot升級到2.6.7,同樣適用於2.7.0,2.7.18等 --> ...


一、pom.xml需要引入的依賴
二、項目開啟熔斷器開關
  2.1 註解方式
  2.2 xml方式
三、依賴類缺失問題
四、版本匹配安全檢查問題
五、測試驗證
六、結論

一、pom.xml需要引入的依賴

pom.xml

 <!-- springboot升級到2.6.7,同樣適用於2.7.0,2.7.18等 -->
   <parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>2.6.7</version>
       <relativePath/> <!-- lookup parent from repository -->
   </parent>  
        
     <!-- hystrix需要升級到2.x以上版本 -->
       <dependency>
           <groupId>org.springframework.cloud</groupId>
           <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
           <version>2.2.10.RELEASE</version>
      </dependency>
 
    <!-- 升級後運行時缺失依賴 -->
     <dependency>
       <groupId>org.hdrhistogram</groupId>
       <artifactId>HdrHistogram</artifactId>
       <version>2.1.12</version>
     </dependency>

二、項目開啟熔斷器開關

2.1 註解方式

@EnableHystrix

@EnableCircuitBreaker

註:項目啟動類中加上以上註解,以上兩者取其一即可;

2.2 xml方式

以上註解方式底層就是實例化此類:

三、依賴類缺失問題

此時運行項目將報以下錯誤:

errpr.log
 D:\JDK\jdk1.8\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55698,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:C:\Users\mingming.chen\AppData\Local\JetBrains\IntelliJIdea2021.3\captureAgent\debugger-agent.jar -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath "D:\JDK\jdk1.8\jre\lib\charsets.jar;D:\JDK\jdk1.8\jre\lib\deploy.jar;D:\JDK\jdk1.8\jre\lib\ext\access-bridge-64.jar;D:\JDK\jdk1.8\jre\lib\ext\cldrdata.jar;D:\JDK\jdk1.8\jre\lib\ext\dnsns.jar;D:\JDK\jdk1.8\jre\lib\ext\jaccess.jar;D:\JDK\jdk1.8\jre\lib\ext\jfxrt.jar;D:\JDK\jdk1.8\jre\lib\ext\localedata.jar;D:\JDK\jdk1.8\jre\lib\ext\nashorn.jar;D:\JDK\jdk1.8\jre\lib\ext\sunec.jar;D:\JDK\jdk1.8\jre\lib\ext\sunjce_provider.jar;D:\JDK\jdk1.8\jre\lib\ext\sunmscapi.jar;D:\JDK\jdk1.8\jre\lib\ext\sunpkcs11.jar;D:\JDK\jdk1.8\jre\lib\ext\zipfs.jar;D:\JDK\jdk1.8\jre\lib\javaws.jar;D:\JDK\jdk1.8\jre\lib\jce.jar;D:\JDK\jdk1.8\jre\lib\jfr.jar;D:\JDK\jdk1.8\jre\lib\jfxswt.jar;D:\JDK\jdk1.8\jre\lib\jsse.jar;D:\JDK\jdk1.8\jre\lib\management-agent.jar;D:\JDK\jdk1.8\jre\lib\plugin.jar;D:\JDK\jdk1.8\jre\lib\resources.jar;D:\JDK\jdk1.8\jre\lib\rt.jar;D:\LocalReposition\oherproject\testProject\PersonalAssistant\target\classes;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter\2.6.7\spring-boot-starter-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot\2.6.7\spring-boot-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\spring-context\5.3.19\spring-context-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-autoconfigure\2.6.7\spring-boot-autoconfigure-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-logging\2.6.7\spring-boot-starter-logging-2.6.7.jar;D:\MAVEN\MavenRepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\MAVEN\MavenRepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\MAVEN\MavenRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\MAVEN\MavenRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\MAVEN\MavenRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\MAVEN\MavenRepository\org\springframework\spring-core\5.3.19\spring-core-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\spring-jcl\5.3.19\spring-jcl-5.3.19.jar;D:\MAVEN\MavenRepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-test\2.6.7\spring-boot-starter-test-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-test\2.6.7\spring-boot-test-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-test-autoconfigure\2.6.7\spring-boot-test-autoconfigure-2.6.7.jar;D:\MAVEN\MavenRepository\com\jayway\jsonpath\json-path\2.6.0\json-path-2.6.0.jar;D:\MAVEN\MavenRepository\net\minidev\json-smart\2.4.8\json-smart-2.4.8.jar;D:\MAVEN\MavenRepository\net\minidev\accessors-smart\2.4.8\accessors-smart-2.4.8.jar;D:\MAVEN\MavenRepository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;D:\MAVEN\MavenRepository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;D:\MAVEN\MavenRepository\org\assertj\assertj-core\3.21.0\assertj-core-3.21.0.jar;D:\MAVEN\MavenRepository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar;D:\MAVEN\MavenRepository\org\junit\jupiter\junit-jupiter\5.8.2\junit-jupiter-5.8.2.jar;D:\MAVEN\MavenRepository\org\junit\jupiter\junit-jupiter-api\5.8.2\junit-jupiter-api-5.8.2.jar;D:\MAVEN\MavenRepository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;D:\MAVEN\MavenRepository\org\junit\platform\junit-platform-commons\1.8.2\junit-platform-commons-1.8.2.jar;D:\MAVEN\MavenRepository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;D:\MAVEN\MavenRepository\org\junit\jupiter\junit-jupiter-params\5.8.2\junit-jupiter-params-5.8.2.jar;D:\MAVEN\MavenRepository\org\junit\jupiter\junit-jupiter-engine\5.8.2\junit-jupiter-engine-5.8.2.jar;D:\MAVEN\MavenRepository\org\junit\platform\junit-platform-engine\1.8.2\junit-platform-engine-1.8.2.jar;D:\MAVEN\MavenRepository\org\mockito\mockito-core\4.0.0\mockito-core-4.0.0.jar;D:\MAVEN\MavenRepository\net\bytebuddy\byte-buddy\1.11.22\byte-buddy-1.11.22.jar;D:\MAVEN\MavenRepository\net\bytebuddy\byte-buddy-agent\1.11.22\byte-buddy-agent-1.11.22.jar;D:\MAVEN\MavenRepository\org\objenesis\objenesis\3.2\objenesis-3.2.jar;D:\MAVEN\MavenRepository\org\mockito\mockito-junit-jupiter\4.0.0\mockito-junit-jupiter-4.0.0.jar;D:\MAVEN\MavenRepository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;D:\MAVEN\MavenRepository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\MAVEN\MavenRepository\org\springframework\spring-test\5.3.19\spring-test-5.3.19.jar;D:\MAVEN\MavenRepository\org\xmlunit\xmlunit-core\2.8.4\xmlunit-core-2.8.4.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-web\2.6.7\spring-boot-starter-web-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-json\2.6.7\spring-boot-starter-json-2.6.7.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\core\jackson-databind\2.13.2.1\jackson-databind-2.13.2.1.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.7\spring-boot-starter-tomcat-2.6.7.jar;D:\MAVEN\MavenRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.62\tomcat-embed-core-9.0.62.jar;D:\MAVEN\MavenRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.62\tomcat-embed-el-9.0.62.jar;D:\MAVEN\MavenRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.62\tomcat-embed-websocket-9.0.62.jar;D:\MAVEN\MavenRepository\org\springframework\spring-web\5.3.19\spring-web-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\spring-beans\5.3.19\spring-beans-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\spring-webmvc\5.3.19\spring-webmvc-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\spring-aop\5.3.19\spring-aop-5.3.19.jar;D:\MAVEN\MavenRepository\org\springframework\spring-expression\5.3.19\spring-expression-5.3.19.jar;D:\MAVEN\MavenRepository\org\apache\mahout\mahout-math\0.13.0\mahout-math-0.13.0.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-math3\3.2\commons-math3-3.2.jar;D:\MAVEN\MavenRepository\com\google\guava\guava\14.0.1\guava-14.0.1.jar;D:\MAVEN\MavenRepository\it\unimi\dsi\fastutil\7.0.12\fastutil-7.0.12.jar;D:\MAVEN\MavenRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\MAVEN\MavenRepository\com\tdunning\t-digest\3.1\t-digest-3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-clustering-kmeans\4.3.1\tribuo-clustering-kmeans-4.3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-core\4.3.1\tribuo-core-4.3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-util-onnx\4.3.1\tribuo-util-onnx-4.3.1.jar;D:\MAVEN\MavenRepository\com\oracle\labs\olcut\olcut-config-protobuf\5.2.1\olcut-config-protobuf-5.2.1.jar;D:\MAVEN\MavenRepository\com\google\protobuf\protobuf-java\3.19.6\protobuf-java-3.19.6.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-data\4.3.1\tribuo-data-4.3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-util-tokenization\4.3.1\tribuo-util-tokenization-4.3.1.jar;D:\MAVEN\MavenRepository\com\opencsv\opencsv\5.7.1\opencsv-5.7.1.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-text\1.10.0\commons-text-1.10.0.jar;D:\MAVEN\MavenRepository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;D:\MAVEN\MavenRepository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\MAVEN\MavenRepository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-math\4.3.1\tribuo-math-4.3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-clustering-core\4.3.1\tribuo-clustering-core-4.3.1.jar;D:\MAVEN\MavenRepository\org\tribuo\tribuo-util-infotheory\4.3.1\tribuo-util-infotheory-4.3.1.jar;D:\MAVEN\MavenRepository\com\oracle\labs\olcut\olcut-core\5.2.1\olcut-core-5.2.1.jar;D:\MAVEN\MavenRepository\org\jline\jline-terminal\3.21.0\jline-terminal-3.21.0.jar;D:\MAVEN\MavenRepository\org\jline\jline-reader\3.21.0\jline-reader-3.21.0.jar;D:\MAVEN\MavenRepository\org\jline\jline-builtins\3.21.0\jline-builtins-3.21.0.jar;D:\MAVEN\MavenRepository\org\jline\jline-style\3.21.0\jline-style-3.21.0.jar;D:\MAVEN\MavenRepository\org\jline\jline-terminal-jansi\3.21.0\jline-terminal-jansi-3.21.0.jar;D:\MAVEN\MavenRepository\org\fusesource\jansi\jansi\2.4.0\jansi-2.4.0.jar;D:\MAVEN\MavenRepository\cn\xiaoandcai\JsonDiff\1.2.1\JsonDiff-1.2.1.jar;D:\MAVEN\MavenRepository\com\alibaba\fastjson2\fastjson2\2.0.7\fastjson2-2.0.7.jar;D:\MAVEN\MavenRepository\org\apache\poi\poi\5.2.3\poi-5.2.3.jar;D:\MAVEN\MavenRepository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar;D:\MAVEN\MavenRepository\commons-io\commons-io\2.11.0\commons-io-2.11.0.jar;D:\MAVEN\MavenRepository\com\zaxxer\SparseBitSet\1.2\SparseBitSet-1.2.jar;D:\MAVEN\MavenRepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\MAVEN\MavenRepository\org\apache\poi\poi-ooxml\5.2.3\poi-ooxml-5.2.3.jar;D:\MAVEN\MavenRepository\org\apache\poi\poi-ooxml-lite\5.2.3\poi-ooxml-lite-5.2.3.jar;D:\MAVEN\MavenRepository\org\apache\xmlbeans\xmlbeans\5.1.1\xmlbeans-5.1.1.jar;D:\MAVEN\MavenRepository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-compress\1.21\commons-compress-1.21.jar;D:\MAVEN\MavenRepository\com\github\virtuald\curvesapi\1.07\curvesapi-1.07.jar;D:\MAVEN\MavenRepository\com\alibaba\easyexcel\3.3.2\easyexcel-3.3.2.jar;D:\MAVEN\MavenRepository\com\alibaba\easyexcel-core\3.3.2\easyexcel-core-3.3.2.jar;D:\MAVEN\MavenRepository\com\alibaba\easyexcel-support\3.3.2\easyexcel-support-3.3.2.jar;D:\MAVEN\MavenRepository\org\apache\poi\poi-ooxml-schemas\4.1.2\poi-ooxml-schemas-4.1.2.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-csv\1.8\commons-csv-1.8.jar;D:\MAVEN\MavenRepository\org\ehcache\ehcache\3.9.9\ehcache-3.9.9.jar;D:\MAVEN\MavenRepository\org\apache\httpcomponents\client5\httpclient5\5.2.1\httpclient5-5.2.1.jar;D:\MAVEN\MavenRepository\org\apache\httpcomponents\core5\httpcore5\5.1.3\httpcore5-5.1.3.jar;D:\MAVEN\MavenRepository\org\apache\httpcomponents\core5\httpcore5-h2\5.1.3\httpcore5-h2-5.1.3.jar;D:\MAVEN\MavenRepository\cn\hutool\hutool-http\5.8.22\hutool-http-5.8.22.jar;D:\MAVEN\MavenRepository\cn\hutool\hutool-core\5.8.22\hutool-core-5.8.22.jar;D:\MAVEN\MavenRepository\cn\hutool\hutool-all\5.8.22\hutool-all-5.8.22.jar;D:\MAVEN\MavenRepository\redis\clients\jedis\5.0.0\jedis-5.0.0.jar;D:\MAVEN\MavenRepository\org\apache\commons\commons-pool2\2.11.1\commons-pool2-2.11.1.jar;D:\MAVEN\MavenRepository\org\json\json\20230618\json-20230618.jar;D:\MAVEN\MavenRepository\com\google\code\gson\gson\2.8.9\gson-2.8.9.jar;D:\MAVEN\MavenRepository\com\alibaba\fastjson\1.2.67\fastjson-1.2.67.jar;D:\MAVEN\MavenRepository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-starter-netflix-hystrix\2.2.10.RELEASE\spring-cloud-starter-netflix-hystrix-2.2.10.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-starter\2.2.9.RELEASE\spring-cloud-starter-2.2.9.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-context\2.2.9.RELEASE\spring-cloud-context-2.2.9.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\security\spring-security-crypto\5.6.3\spring-security-crypto-5.6.3.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-commons\2.2.9.RELEASE\spring-cloud-commons-2.2.9.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\security\spring-security-rsa\1.0.9.RELEASE\spring-security-rsa-1.0.9.RELEASE.jar;D:\MAVEN\MavenRepository\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;D:\MAVEN\MavenRepository\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-netflix-hystrix\2.2.10.RELEASE\spring-cloud-netflix-hystrix-2.2.10.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\boot\spring-boot-starter-aop\2.6.7\spring-boot-starter-aop-2.6.7.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-netflix-ribbon\2.2.10.RELEASE\spring-cloud-netflix-ribbon-2.2.10.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-netflix-archaius\2.2.10.RELEASE\spring-cloud-netflix-archaius-2.2.10.RELEASE.jar;D:\MAVEN\MavenRepository\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.2.10.RELEASE\spring-cloud-starter-netflix-archaius-2.2.10.RELEASE.jar;D:\MAVEN\MavenRepository\com\netflix\archaius\archaius-core\0.7.7\archaius-core-0.7.7.jar;D:\MAVEN\MavenRepository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;D:\MAVEN\MavenRepository\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\MAVEN\MavenRepository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\MAVEN\MavenRepository\com\netflix\hystrix\hystrix-core\1.5.18\hystrix-core-1.5.18.jar;D:\MAVEN\MavenRepository\com\netflix\hystrix\hystrix-serialization\1.5.18\hystrix-serialization-1.5.18.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\module\jackson-module-afterburner\2.13.2\jackson-module-afterburner-2.13.2.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\MAVEN\MavenRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\MAVEN\MavenRepository\com\netflix\hystrix\hystrix-metrics-event-stream\1.5.18\hystrix-metrics-event-stream-1.5.18.jar;D:\MAVEN\MavenRepository\com\netflix\hystrix\hystrix-javanica\1.5.18\hystrix-javanica-1.5.18.jar;D:\MAVEN\MavenRepository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;D:\MAVEN\MavenRepository\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar;D:\MAVEN\MavenRepository\io\reactivex\rxjava-reactive-streams\1.2.1\rxjava-reactive-streams-1.2.1.jar;D:\MAVEN\MavenRepository\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;D:\MAVEN\MavenRepository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;D:\MAVEN\MavenRepository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;D:\idea\IntelliJ IDEA 2021.3\lib\idea_rt.jar" com.example.springbootdame.PersonalAssistantApplication
Connected to the target VM, address: '127.0.0.1:55698', transport: 'socket'
2024-01-16 15:44:01.575 [al-service] [main] WARN  [org.springframework.context.annotation.AnnotationConfigApplicationContext] -Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
2024-01-16 15:44:01.581 [al-service] [main] INFO  [org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener] -
 
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-01-16 15:44:01.603 [al-service] [main] ERROR [org.springframework.boot.SpringApplication] -Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
    at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:339)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:297)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
    at com.example.springbootdame.PersonalAssistantApplication.main(PersonalAssistantApplication.java:12)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485)
    at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:305)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1116)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    ... 30 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467)
    ... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 41 common frames omitted
2024-01-16 15:44:01.606 [al-service] [main] ERROR [org.springframework.boot.SpringApplication] -Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
    at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:339)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:297)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
    at com.example.springbootdame.PersonalAssistantApplication.main(PersonalAssistantApplication.java:12)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485)
    at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:305)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1116)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    ... 30 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467)
    ... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 41 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:55698', transport: 'socket'
 
Process finished with exit code 1

報錯原因是缺失特定路徑下的類org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata,如下所示:

需要解決此問題,自定義此類即可,註意一定要定義成框架所需的包路徑(package org.springframework.boot.context.properties;):

ConfigurationBeanFactoryMetadata.java

 package org.springframework.boot.context.properties;
 
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
 
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
 
/**
 * @Author: mingming.chen
 * @Date: 2024/1/15 14 26
 * @Description:
 **/
public class ConfigurationBeanFactoryMetadata implements BeanFactoryPostProcessor {
 
    private ConfigurableListableBeanFactory beanFactory;
 
    private Map<String, MetaData> beans = new HashMap<String, MetaData>();
 
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
            throws BeansException {
        this.beanFactory = beanFactory;
        for (String name : beanFactory.getBeanDefinitionNames()) {
            BeanDefinition definition = beanFactory.getBeanDefinition(name);
            String method = definition.getFactoryMethodName();
            String bean = definition.getFactoryBeanName();
            if (method != null && bean != null) {
                this.beans.put(name, new MetaData(bean, method));
            }
        }
    }
 
    public <A extends Annotation> Map<String, Object> getBeansWithFactoryAnnotation(
            Class<A> type) {
        Map<String, Object> result = new HashMap<String, Object>();
        for (String name : this.beans.keySet()) {
            if (findFactoryAnnotation(name, type) != null) {
                result.put(name, this.beanFactory.getBean(name));
            }
        }
        return result;
    }
 
    public <A extends Annotation> A findFactoryAnnotation(String beanName,
                                                          Class<A> type) {
        Method method = findFactoryMethod(beanName);
        return (method == null ? null : AnnotationUtils.findAnnotation(method, type));
    }
 
    private Method findFactoryMethod(String beanName) {
        if (!this.beans.containsKey(beanName)) {
            return null;
        }
        final AtomicReference<Method> found = new AtomicReference<Method>(null);
        MetaData meta = this.beans.get(beanName);
        final String factory = meta.getMethod();
        Class<?> type = this.beanFactory.getType(meta.getBean());
        ReflectionUtils.doWithMethods(type, new ReflectionUtils.MethodCallback() {
            @Override
            public void doWith(Method method)
                    throws IllegalArgumentException, IllegalAccessException {
                if (method.getName().equals(factory)) {
                    found.compareAndSet(null, method);
                }
            }
        });
        return found.get();
    }
 
    private static class MetaData {
 
        private String bean;
 
        private String method;
 
        MetaData(String bean, String method) {
            this.bean = bean;
            this.method = method;
        }
 
        public String getBean() {
            return this.bean;
        }
 
        public String getMethod() {
            return this.method;
        }
    }
}

四、版本匹配安全檢查問題

此時,同樣啟動項目,報以下錯誤,並中斷進程:

 

 

如上所示,由於spring-cloud-starter-netflix-hystrix 2021年後不更新,此依賴包對應的springCloud版本和springboot版本不匹配,會報版本不匹配異常,需要禁用安全檢查功能,如下配置在application.yml文件中:

spring:
  cloud:
    compatibility-verifier:
       enabled: false

檢查配置說明:

相容性驗證器是Spring Cloud框架中的一個功能,用於確保所使用的Spring Boot版本與Spring Cloud版本相容。當Spring Boot版本與Spring Cloud版本不相容時,可能會導致應用程式在運行時出現問題。

在上述代碼中,cloud.compatibility-verifier.enabled屬性被設置為false,意味著禁用了相容性驗證器。這意味著應用程式將不再執行Spring Boot與Spring Cloud版本的相容性檢查。

禁用相容性驗證器可能會導致以下問題:

  1. 不相容的Spring Boot和Spring Cloud版本可能導致應用程式在運行時出現錯誤或異常。
  2. 可能會錯過一些Spring Cloud提供的新功能或修複的問題。

因此,在禁用相容性驗證器之前,應該確保所使用的Spring Boot版本與Spring Cloud版本相容,並且瞭解可能的風險和影響。

五、測試驗證

  1. 熔斷;
  2. 降級;
  3. 線程池隔離:併發數超過設置線程池個數請求進行降級;

六、結論

完成以上前四步即可在springboot2.6.x和2.7.x使用hystrix組件。


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • Linux 是一個嚴謹的操作系統,每個目錄存放什麼文件是有明確的要求和規範的。我們應該去瞭解這些目錄的作用,然後按照目錄要求去操作。 ...
  • 一、海豚調度介紹 Apache DolphinScheduler 是一個分散式易擴展的可視化DAG工作流任務調度開源系統。適用於企業級場景,提供了一個可視化操作任務、工作流和全生命周期數據處理過程的解決方案。 Apache DolphinScheduler 旨在解決複雜的大數據任務依賴關係,併為應用 ...
  • 下麵介紹三種用於進行排序的專用視窗函數: 1、RANK() 在計算排序時,若存在相同位次,會跳過之後的位次。 例如,有3條排在第1位時,排序為:1,1,1,4······ 2、DENSE_RANK() 這就是題目中所用到的函數,在計算排序時,若存在相同位次,不會跳過之後的位次。 例如,有3條排在第1 ...
  • 在近日舉辦的鴻蒙生態千帆啟航儀式上,華為常務董事、終端BG CEO餘承東表示,鴻蒙生態設備已經增至8億 ,將打開萬億產業新藍海。 在本次論壇上,華為宣佈HarmonyOS NEXT鴻蒙星河版(開發者預覽版)已面向開發者開放申請。該版本,能夠實現原生精緻、原生易用、原生流暢、原生安全、原生智能、原生互 ...
  • 這裡給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 依賴管理解決了在軟體開發過程中管理和協調各種依賴項的問題,簡化了開發流程,提高了項目的可靠性、可維護性和可重覆性。它們幫助開發人員更高效地管理項目的依賴關係,減少了潛在的錯誤和衝突,並提供了更好的開發體驗。 常用的依賴管理 在 JavaS ...
  • 最近,有群里在群里發了這麼一個非常有意思的卡片 Hover 動效,來源於此網站 -- key-drop,效果如下: 非常有意思酷炫的效果。而本文,我們不會完全還原此效果,而是基於此效果,嘗試去製作這麼一個類似的卡片交互效果: 該效果的幾個核心點: 卡片的 3D 旋轉跟隨滑鼠移動效果 如何讓卡片在 H ...
  • 一、定義 定義一個操作中演算法的框架,而將一些步驟延遲到子類中。模板方法模式使得子類不改變一個演算法的結構即可重定義該演算法的特定步驟。模板方法是一種類行為型模式 二、描述 模板方法模式結構比較簡單,其核心是抽象類和其中的模板方法的設計,包含以下兩個角色: 1、AbstractClass(抽象類):在抽象 ...
  • 本文在原文基礎上有刪減,原文參考泛型、Trait 和生命周期。 目錄泛型數據類型在函數定義中使用泛型結構體定義中的泛型枚舉定義中的泛型方法定義中的泛型泛型代碼的性能Trait:定義共同行為定義 trait為類型實現 trait預設實現trait 作為參數Trait Bound 語法通過 + 指定多個 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...