SpringBoot版本2.4.0以及2.4.0以下的,升级到高版本,也调整了与之兼容的spring-cloud-starter-alibaba-nacos,但依旧出现校验问题,
1、导致Spring Boot项目启动异常:
No spring.config.import property has been defined
Action:
Add a spring.config.import=nacos: property to your configuration.
If configuration is not required add spring.config.import=optional:nacos: instead.
To disable this check, set spring.cloud.nacos.config.import-check.enabled=false.
原因: 原始的低版本,与之对应的spring-cloud-starter-alibaba-nacos插件也进行了调整,旧版本的spring-cloud-starter-alibaba-nacos默认启用配置中心管理机制;会去nacos配置中心读取nacos配置中心的配置文件;读取不到就会出异常; 解决此问题,需在自己的 *.yml 或者 *.property配置文件里,添加:spring.cloud.nacos.config.import-check.enabled=false.;即:不进行nacos配置管理校验,不启用配置管理
2、启动异常二:
Connected to the target VM, address: ‘127.0.0.1:61179’, transport: ‘socket’
10:07:45.781 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Unable to load config data from ‘nacos:nacos-config-example.properties?refreshEnabled=true’
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:141) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:126) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:119) ~[spring-boot-2.7.3.jar:2.7.3]
at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve 1 ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 115 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 126 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 115 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a L o c a t i o n R e s o l v e r s . r e s o l v e ( C o n f i g D a t a L o c a t i o n R e s o l v e r s . j a v a : 107 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a I m p o r t e r . r e s o l v e ( C o n f i g D a t a I m p o r t e r . j a v a : 105 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a I m p o r t e r . r e s o l v e ( C o n f i g D a t a I m p o r t e r . j a v a : 97 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a I m p o r t e r . r e s o l v e A n d L o a d ( C o n f i g D a t a I m p o r t e r . j a v a : 85 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a E n v i r o n m e n t C o n t r i b u t o r s . w i t h P r o c e s s e d I m p o r t s ( C o n f i g D a t a E n v i r o n m e n t C o n t r i b u t o r s . j a v a : 116 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a E n v i r o n m e n t . p r o c e s s W i t h P r o f i l e s ( C o n f i g D a t a E n v i r o n m e n t . j a v a : 311 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a E n v i r o n m e n t . p r o c e s s A n d A p p l y ( C o n f i g D a t a E n v i r o n m e n t . j a v a : 232 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . p o s t P r o c e s s E n v i r o n m e n t ( C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . j a v a : 102 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . c o n t e x t . c o n f i g . C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . p o s t P r o c e s s E n v i r o n m e n t ( C o n f i g D a t a E n v i r o n m e n t P o s t P r o c e s s o r . j a v a : 94 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . e n v . E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . o n A p p l i c a t i o n E n v i r o n m e n t P r e p a r e d E v e n t ( E n v i r o n m e n t P o s t P r o c e s s o r A p p l i c a t i o n L i s t e n e r . j a v a : 102 ) [ s p r i n g − b o o t − 2.7.3. j a r : 2.7.3 ] a t o r g . s p r i n g f r a m e w o r k . b o o t .
SpringBoot2.4.0及2.3.*,版本升级:出现的版本不兼容
于 2024-07-09 15:50:12 首次发布