Error creating bean with name configurationpropertiesbeans

When i try to run my spring boot application i get this Exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in ...

I had a same issue, and it is happening because of Spring Cloud services and Spring Boot version issues. I got rid of it by using https://start.spring.io/ to generate my project.

When you select all dependencies needed for your project, you can then click the Explore button and check the pom.xml file.

This issue happened to me when I tried to add dependency for Eureka-client to my pom.xml after generating project, so using IntelliJ.

I got the same error.

Then I went to Spring.io again select dependencies that I use for my project and also dependency for Eureka-client, clicked on Explore button and saw that I need to add this line of code under java version in pom.xml

<spring-cloud.version>2020.0.3</spring-cloud.version>

But also this lines as well:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

So I just copy pasted it to my existing pom.xml and it worked!

A build error occurred as below.

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 [jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:586) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.4.0.jar:2.4.0]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.0.jar:2.4.0]
	at net.class101.inventory.ApplicationKt.main(Application.kt:13) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.1.jar:5.3.1]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:417) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:388) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:335) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1100) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.3.1.jar:5.3.1]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3325) ~[na:na]
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2466) ~[na:na]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.1.jar:5.3.1]
	... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
	... 41 common frames omitted

2020-11-15 12:06:40.084 ERROR [,,,] 83147 --- [           main] o.s.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 [jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:586) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:203) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:196) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:170) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:148) ~[spring-context-5.3.1.jar:5.3.1]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.4.0.jar:2.4.0]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.0.jar:2.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.0.jar:2.4.0]
	at net.class101.inventory.ApplicationKt.main(Application.kt:13) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.1.jar:5.3.1]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:417) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:388) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:335) ~[spring-orm-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1100) ~[spring-beans-5.3.1.jar:5.3.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.3.1.jar:5.3.1]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3325) ~[na:na]
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2466) ~[na:na]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.1.jar:5.3.1]
	... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
	... 41 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:57507', transport: 'socket'

I just removed implementation("org.springframework.cloud:spring-cloud-starter-sleuth:2.2.5.RELEASE") dependency, and the build succeeded.

Содержание

  1. ProgrammerAH
  2. Programmer Guide, Tips and Tutorial
  3. SpringCloud: Error creating bean with name ‘configurationPropertiesBeans‘
  4. Error creating bean with name ‘configurationPropertiesBeans’ defined in class path resource /ConfigurationPropertiesRebinderAutoConfiguration.class]
  5. 1 Answer 1
  6. Миграция Spring Boot приложения на Java 17 — сложный путь: День 2
  7. День второй
  8. Spring Cloud
  9. Примечания к версии
  10. Spring Cloud Kubernetes
  11. Первая попытка — использование нового клиента
  12. Потом пришел Jenkins
  13. Отключение Spring Cloud Kubernetes в тестах
  14. Вторая попытка — использование существующего клиента Fabric8
  15. Уроки обновления Spring Cloud Kubernetes
  16. Spring Cloud Netflix
  17. Spring Data
  18. Примечания к версии
  19. Spring Data Rest
  20. Репозитории rest контроллеров
  21. Настройка типа содержимого Rest контроллера
  22. Управление версиями конечных точек Rest контроллера
  23. Извлеченные уроки обновления Spring Data Rest
  24. Spring Kafka
  25. Настройка потребителей
  26. Сообщения Kafka с JsonFilter
  27. Извлеченные уроки обновления Spring Kafka
  28. Уроки, извлеченные во время обновления Spring Boot
  29. Миграция Spring Boot на Java 17 — Резюме

ProgrammerAH

Programmer Guide, Tips and Tutorial

SpringCloud: Error creating bean with name ‘configurationPropertiesBeans‘

[problem phenomenon]

When the springcloud system is built in the idea, a red error is prompted at runtime:

[reason]

This is a very common problem in the spring cloud system because the spring boot version is incompatible with the spring cloud version.

[solution]

The spring boot version and spring cloud version should be matched in strict accordance with the official version. Link to the official website:
https://spring.io/projects/spring-cloud

Different clouds need different boot versions, as shown in the figure:

Example of version change:

after version replacement, reload all Maven items, as shown in the figure:

If an error is still reported, re-execute the MVN clean package

Источник

Error creating bean with name ‘configurationPropertiesBeans’ defined in class path resource /ConfigurationPropertiesRebinderAutoConfiguration.class]

I can build the application (Kotlin+Spring+Spring Cloud) but I can’t start it. Based on what I searched around it is related to incompability among Spring dependencies. I found someone facing similar issue as mine but after applying its solution I keep getting same issue other question

I tried also the the trick suggested with Spring Initializr but I got nothing when I type spring-cloud-starter

I guess the issue will fix when I set correct versions for:

Here is my gradle.build.kts

and its gradle.properties

1 Answer 1

The version you have declared for your spring cloud dependency ( 2.2.9.RELEASE ) is not compatible with spring boot 2.4. You need at least 3.0.0 See the table on https://spring.io/projects/spring-cloud — specifically follow the link to the spring cloud 2020 releases since that’s what corresponds to spring boot 2.4. I think this is likely the cause of your issue, but I have a few other suggestions to help keep things in sync.

I see kotlin version 1.4.10 but spring.kotlin version 1.5.20 and they usually keep lock step with one another, so it’s best to at least use the same major version of both (in this case, 1.5.x) i.e. in your gradle.properties update the kotlin version to 1.5.x, and then in the build.gradle use

Also note the updated spring dependency management version. Since you’ve declared the spring boot version, and you’re using the dependency management plugin, you should let it pull in the versions that it wants — you shouldn’t declare the $springVersion on your dependencies, and you don’t need the springVersion variable in your gradle.properties. The dependency management will pull in the proper version, which is already being done for your webflux dependency. This part is the second most likely cause of your problem.

If you’re absolutely sure that the versions you have declared are compatible with one another, make sure an older version of cloud isn’t being unexpectedly pulled in.

./gradlew dependencies —configuration compileClasspath

./gradlew -q dependencyInsight —dependency spring-cloud-starter-openfeign —configuration compileClasspath

If you’re able to tease out the culprit that’s bringing in the older version, you can prevent the older version from being pulled in transitively. In the snippet below, I’m omitting logger because I prefer log4j2, but you can substitute the old package, and if you’re declaring the same package with a newer version, it’ll be preferred

Источник

Миграция Spring Boot приложения на Java 17 — сложный путь: День 2

Добро пожаловать в статью о миграции приложения Spring Boot на Java 17 — трудный путь.

пытались использовать Java 17 со Spring Boot 2.3.3.RELEASE, не сработало

обновили Lombok и MapStruct

не удалось обновить ASM, так как Spring переупаковывает ASM

обновлен Spring Boot до версии 2.5.7

покрыли JUnit и FasterJackson

завершили день компиляцией нашего кода и зелеными юнит тестами.

В этом посте мы рассмотрим миграции:

День второй

У нас хорошее начало, но мы еще не закончили. Давайте перекомпилируем все и посмотрим, где мы находимся:

Похоже, у нас возникла проблема с одним из наших интеграционных тестов, поэтому давайте углубимся в Spring Cloud.

Spring Cloud

Spring Cloud предоставляет ряд инструментов для разработки распределенных систем, работающих в облаке. В нашем проекте мы используем два модуля: Spring Cloud Kubernetes и Spring Cloud Netflix.

В настоящее время мы используем Spring Cloud Hoxton, в частности версию Hoxton.RELEASE .

Согласно матрице совместимости, Hoxton не поддерживает Spring Boot 2.5.x . Нам нужно обновить как минимум до Spring Cloud 2020.0.3 (обратите внимание, что здесь также используется новая схема версий).

Поиск в GitHub класса org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata показывает, что он был удален в версии 2.4.

Давайте продолжим и обновим нашу версию Spring Cloud до 2020.0.4 (последней версии исправления на момент написания этой статьи).

После обновления моя IDE сообщает, что используемую нами зависимость больше нельзя разрешить. Мы рассмотрим это ниже.

Примечания к версии

Для справки приведены примечания к версии Spring Cloud 2020.0 для всех версий исправлений.

Spring Cloud Kubernetes

Spring Cloud Kubernetes помогает разработчикам запускать приложения в Kubernetes. Несмотря на то, что она имеет ряд интересных функций, мы используем только его поддержку внешней конфигурации.

Конфигурация нашего приложения — вы знаете, application.properties|yml , которая настраивает Spring Boot приложение — хранится в k8s ConfigMap, и Spring Cloud Kubernetes делает эту внешнюю конфигурацию доступной для приложения во время запуска.

Возвращаемся к коду, наша IDE жалуется, что зависимость spring-cloud-starter-kubernetes-config не может быть разрешена.

Согласно примечаниям к версии, 2020.0 была проведена реструктуризация существующих модулей spring-cloud-kubernetes и представлен второй клиент на основе официального Java-клиента Kubernetes. Существующая реализация Fabric8 была переименована (чтобы было понятно, какой клиент используется).

Пользователи Spring Cloud Kubernetes теперь могут выбирать между двумя реализациями:

Я искал указания, когда использовать одну или другую, но ничего не нашел в документации, только примечания к версии. Я нашел это сообщение в блоге Рохана Кумара, который провел довольно хорошее сравнение этих двух реализаций. Обязательно загляните в его блог, чтобы найти несколько очень хороших сообщений о k8s.

То, что будет дальше, представляет только мой опыт и полученные уроки. У вас может быть другой опыт, и я хотел бы услышать о нем от вас.

Первая попытка — использование нового клиента

Воспользуемся новым официальным Java-клиентом Kubernetes, переключившись с существующего клиента fabric8. Ничего не имею против клиента fabric8, я просто предпочитаю использовать официальные вещи. Кроме того, нам не нужны какие-либо функции, которые предоставляет только клиент fabric8.

Я удалил зависимость spring-cloud-starter-kubernetes-config и добавил новую:

Сначала все выглядело многообещающе. Локально проект скомпилирован, и юнит тесты/тесты интеграции были зелеными. Потрясающе, подумал я, это было легко. Оказывается, все не так просто.

Потом пришел Jenkins

Я закоммитил свои изменения в ветке и сделал push в Bitbucket. Признаюсь, я большой поклонник отдельных веток для фич и горжусь этим. Я знаю, что некоторые из моих коллег будут меня за это проклинать (подражая Thomas Traude). Через несколько минут я получил уведомление о том, что моя сборка Jenkins была красной.

Но сборка прошла на моей машине!

Похоже, у нас есть ненадежные тесты. В зависимости от среды контекст приложения может не загружаться. Это определенное разочарование, но не волнуйтесь, мне нравятся подобные проблемы.

Если вы спрашиваете себя, почему тесты терпят неудачу, если сборки выполняются в Kubernetes, это потому, что они этого не делают. Наши Jenkins задания не выполняются в Kubernetes, поскольку мы широко используем Testcontainers. Если вы ими не пользуетесь, обязательно попробуйте их, здорово. И их новое облачное решение выглядит очень многообещающим.

Отключение Spring Cloud Kubernetes в тестах

Spring Cloud Kubernetes можно отключить в тестах с помощью свойства spring.cloud.kubernetes.enabled . Поместите это свойство в свои тесты — вот так, и все готово (или, по крайней мере, раньше оно работало).

Я сначала не понял, в чем проблема, но ее надо было исключить. Мы успешно использовали новый Java-клиент Kubernetes в других проектах, а здесь тесты не были нестабильными. Я посмотрел еще раз, оказалось, что в наших проектах используются разные версии. Версия 2020.0.1 работает нормально.

Изменение, вводящее дополнительные свойства конфигурации в Java-клиенте Kubernetes, имело непреднамеренный побочный эффект; свойство spring.cloud.kubernetes.enabled больше не работает должным образом. Больше нет единого свойства для отключения Spring Cloud Kubernetes.

О проблемах сообщалось здесь и здесь, и исправления запланированы в версии 2020.0.5 . К сожалению, на момент написания этой статьи версия 2020.0.5 еще не выпущена. Это улучшение было включено в Spring Cloud 2020.0.2, что объясняет, почему версия 2020.0.1 работала в других проектах.

Согласно документации, эти новые функции можно отключить.

И обратите внимание, что вы можете отключить компоненты конфигурации, установив следующие свойства в контексте Spring:

kubernetes.informer.enabled=false # disables informer injection
kubernetes.reconciler.enabled=false # disables reconciler injection

Что делать? Вместо того, чтобы отключать эти дополнительные свойства в наших тестах, я выбрал другое решение.

Вторая попытка — использование существующего клиента Fabric8

Вернемся к клиенту Fabric8. Замените зависимость spring-cloud-starter-kubernetes-client-config на эту:

Локально сборка зеленая. Выполняем Push в Jenkins и ждем. Всегда помогает скрещивание пальцев, я так и поступил. И вы знаете, отлично сработало; без проблем, ничего, ноль, zip. Я люблю, когда все работает.

Я должен был знать это. Клиент fabric8 хорошо нам служит уже много лет. Не вносите беспорядок в работающую систему!

Уроки обновления Spring Cloud Kubernetes

Похоже, что Java-клиент Spring Cloud Kubernetes еще не готов. Java-клиент Kubernetes представил собственную интеграцию Spring, которая не интегрируется должным образом с конфигурацией Spring. Надеюсь, эти два проекта сотрудничают, и в будущем мы получим красивую чистую конфигурацию на основе Spring. Как только выйдет версия 2020.0.5 я попробую еще раз.

Однако это действительно поднимает важную тему: доверие и уверенность в библиотеках, от которых мы зависим, и в поставляемом нами программном обеспечении.

С одной стороны, в этом проекте было выполнено крупное обновление Spring Cloud, поэтому я ожидал, что что-то сломается. С другой стороны, учитывая, что изменение произошло в версии исправления, я не ожидал, что это произойдет. И это вызывает у меня опасения. Так как было легко обойти ошибку, зачем вообще упоминать об этом? Я считаю важным обсудить и оставить свой отзыв. Когда подобные изменения происходят в версиях исправлений, это может подорвать доверие и уверенность. Особенно, когда пользователи ожидают другого поведения.

Согласно собственному заявлению Spring, релизы следуют календарному плану версий (только что узнал об этом сам), причем проекты используют семантическое управление версиями.

Номера версии MAJOR.MINOR.PATCH, увеличиваются так:

1. MAJOR версия при внесении несовместимых изменений API,

2. MINOR версия, когда добавляется функциональность обратно совместимым образом, и

3. PATCH версия, когда исправляются обратно совместимые ошибки.

Я интерпретирую это как стремление избегать ситуаций, подобных описанным выше. Вы можете интерпретировать это по-разному. Я также понимаю, что s**t случается. В подобных ситуациях я вспоминаю старую поговорку: «Не трогай работающее программное обеспечение». В мире облачных вычислений мы должны быть готовы и иметь возможность обновлять наше программное обеспечение, когда это необходимо. В этом и заключается проблема. Я не знаю, почему в Spring Cloud Kubernetes клиент Kubernetes перепрыгнул на версию 11.0.0 вместо исправления.

Однако у нас есть работающее решение, поэтому давайте перейдем к следующему проекту Spring Cloud.

Spring Cloud Netflix

Spring Cloud Netflix — это коллекция очень популярных и успешных OSS проектов, подаренных Netflix компании Spring.

Spring Cloud Netflix Zuul

Наше приложение-шлюз API использует Spring Cloud Netflix Zuul для обеспечения маршрутизации к серверным системам, а также служб аутентификации и авторизации с помощью OpenID Connect.

Оказывается, Zuul перешла в режим поддержания еще в 2018 году и была удалена из spring-cloud-netflix в этой версии. Ее заменила Spring Cloud Gateway.

Переход с Zuul на Spring Cloud Gateway займет больше суток. Мы решили оставить эту миграцию на другой день, так что мы можем получить работающую систему к концу этого дня. Для этого мы реорганизовали POM, поэтому наше приложение шлюза API остается на Java 11 и продолжает использовать 2.3.3.RELEASE версию Spring Boot. Помните, что мы не собирались обновлять Spring Boot, а включили Java 17. Если Zuul нельзя использовать с Java 17, пусть будет так.

Надеюсь, в будущем мы сможем рассказать об этом в отдельном сообщении в блоге. Скоро нам придется перенести с Zuul из-за его EOL.

Мы завершили обновление Spring Cloud, давайте перейдем к следующему Spring модулю в нашем проекте.

Spring Data

Spring Data — это набор проектов, обеспечивающих доступ к данным знакомым образом на основе Spring.

Как указано в примечаниях к версии, Spring Boot 2.5.x обновлен до Spring Data 2021.0. В частности, Spring Boot 2.5.7 обновлен до Spring Data 2021.0.7 .

Нет необходимости импортировать спецификацию, spring-boot-starter-parent управляет зависимостями Spring Data за нас.

Примечания к версии

Для справки приведены примечания к версии Spring Data 2021.0. Они не содержат много информации, но статья в блоге « Что нового в Spring Data 2010.0 » дает достойный обзор.

Spring Data Rest

Наше приложение использует Spring Data Rest для предоставления сущностей JPA как REST API. Правильно, просто определите свои объекты JPA, отметьте репозиторий и вуаля, у вас есть простое приложение CRUD, которое запускается менее чем за 5 минут.

К сожалению, обновление было не таким быстрым. Компилируя наше приложение, мы получаем следующую ошибку:

Следующий класс больше не компилируется:

Похоже, интерфейс RepositoryRestConfigurer изменился. Я попытался исследовать для этого некоторые примечания к версии, но безуспешно (примечания к версии Spring Data не особенно подробны).

Если посмотреть на код на GitHub, этот метод устарел в 3.4 M2 (2020.0.0) и удален в 3.5 M1 (2021.0.0). Поскольку мы пропустили Spring Boot 2.4.x , мы не видели уведомления об устаревании в Spring Data 2020.0.x . В противном случае мы могли бы перенести наш код до его удаления. Еще один пример того, почему лучше часто обновляться.

Исправить несложно, CorsRegistry добавлен в метод configureRepositoryRestConfiguration . Теперь наш класс выглядит так:

Теперь наш код компилируется, но у нас есть несколько неудачных тестов.

Репозитории rest контроллеров

Некоторые из наших тестов терпят неудачу из-за следующей ошибки:

Что-то еще изменилось в Spring Data Rest. Опять же, я ничего не нашел в примечаниях к версии, но отследил коммит “Prevent duplicate controller registrations through class-level @RequestMapping”, который изменил поведение.

Когда мы обнаружили экземпляры @BasePathAwareController и @RepositoryRestController , теперь мы отклоняем типы, которые используют @RequestMapping на уровне класса это приводит к неизбежной регистрации контроллера с Spring MVC.

Оказывается, мы делали именно это:

Мы настраиваем конечные точки остальных данных с помощью файла @RepositoryRestController . Это все еще возможно, но код необходимо адаптировать. Аннотации @RequestMapping на классе должны быть удалены, и путь добавляется к каждому методу. К счастью, в нашем API есть только несколько методов, но я могу представить, что это разочарует для более крупных API.

Я не проверял поведение в нашем существующем приложении, но я так интерпретирую проблему. При предыдущей обработке «у нашего приложения фактически было бы 2 конечные точки rest, одна обслуживалась Spring Data Rest, другая — Spring MVC». Но, как я уже сказал, я этого не проверял.

После внесения этого изменения эти тесты становятся зелеными, но теперь у нас есть другая проблема.

Настройка типа содержимого Rest контроллера

После этого изменения еще одна серия тестов перестала работать. В некоторых случаях конечные точки Spring Data Rest по умолчанию были настроены и больше не соответствуют, поэтому мы получаем ошибки 404 или 405. Кажется, что настроенные конечные точки должны точно соответствовать конечным точкам Spring Data Rest по умолчанию, иначе они не распознаются.

Я предполагаю, что раньше это работало из-за аннотации @RequestMapping(“/entities”) , которая была получена Spring MVC и обработана как обычная конечная точка. Однако мне не удалось проверить, и я обновлю эту статью, если и когда у меня появится дополнительная информация.

По умолчанию конечные точки Spring Data Rest используют другой тип содержимого application/hal+json . Изменяя конфигурацию Repository Rest API, можно изменить тип содержимого по умолчанию на application/json и «большая часть» наших тестов снова начнет проходить.

Помните класс CustomRepositoryRestConfigurer сверху? Добавим дополнительную конфигурацию:

Это исправляет некоторые тестовые сценарии, но не все.

Управление версиями конечных точек Rest контроллера

К сожалению, мы столкнулись с проблемой с нашими версиями контроллеров Repository Rest. Мы пытаемся версировать API, используя разные типы содержимого, например, application/json для версии 1 и application/vnd.app.v2+json для версии 2.

К вашему сведению — Spring Boot Actuator поддерживает такое управление версиями: application/json , application/vnd.spring-boot.actuator.v2+json и application/vnd.spring-boot.actuator.v3+json .

Некоторые из наших тестов терпят неудачу с такой ошибкой:

Это сработало с Spring Boot 2.3.3-RELEASE , и я могу только предположить, что это было обработано Spring WebMVC, а не Spring Data Rest. Мы так и не нашли решения этой проблемы с помощью Spring Data Rest, поэтому мы реорганизовали API с конечной точкой Spring WebMVC Rest. Если кто-нибудь, читающий это, знает, как добиться этого с помощью Spring Data Rest, свяжитесь со мной, я хотел бы узнать, как это сделать.

При этом, возможно, нет смысла даже делать это. Я не могу спросить разработчиков, почему это было сделано именно так, их здесь больше нет. Историю этого проекта можно рассказать только через его историю Git.

Извлеченные уроки обновления Spring Data Rest

Обновить Spring Data Rest было непросто, но это не имело ничего общего с самим Spring Data Rest. Я подозреваю, что мы неправильно используем Spring Data Rest, неправильно смешивая с WebMVC концепцией. Если бы мы не сделали этого с самого начала, все было бы намного проще.

Теперь мы закончили миграцию Spring Data Rest. Пришло время перейти к следующему модулю Spring, Spring Kafka.

Spring Kafka

Spring Kafka, или, скорее, Spring для Apache Kafka, — отличный способ использовать Kafka в ваших Spring проектах. Он предоставляет простые в использовании шаблоны для отправки сообщений и типичные Spring аннотации для использования сообщений.

Мы используем Kafka для связи между нашими приложениями.

Настройка потребителей

Запустив наши тестовые примеры Kafka, мы получаем следующую ошибку:

Оказывается, мы настраивали bean-компонент consumerConfigs и устанавливали null значения в его свойствах. Следующее изменение с HashMap на ConcurrentHashMap означает, что мы больше не можем задавать в настройках null значения. Мы провели рефакторинги нашего кода, и теперь тесты зеленые. Очень просто.

Сообщения Kafka с JsonFilter

Другой тестовый пример выполнился с этой ошибкой:

Некоторые из наших Java-компонентов используют a @JsonFilter для управления сериализацией и десериализацией. Для этого необходимо настроить propertyFilter в ObjectMapper.

Spring для Apache Kafka внес изменения в JsonSerializer, представив ObjectWriter. При создании экземпляра ObjectWriter конфигурация ObjectMapper копируется, а не указывается. Наш тестовый пример переконфигурировал ObjectMapper с соответствующим propertyFilter после создания экземпляра ObjectWriter. Следовательно, ObjectWriter ничего не знает о propertyFilter (поскольку конфигурация уже была скопирована). После некоторого рефакторинга, изменения способа создания и настройки JsonSerializer , наши тестовые примеры стали зелеными.

Запуск нашей сборки $ mvn clean verify наконец привел к зеленой сборке. Все работает как надо. Мы внесли наши изменения в Bitbucket, и билд был построен прекрасно.

Извлеченные уроки обновления Spring Kafka

Обновление Spring Kafka было очень простым и понятным. Желаю, чтобы все было так просто.

Уроки, извлеченные во время обновления Spring Boot

Spring и Spring Boot отлично документируют свои версии, их примечания к версии поддерживаются в хорошем состоянии. При этом обновление было сложной задачей, потребовалось довольно много времени, прежде чем все снова заработало. Большая часть этого лежит на нас, поскольку мы не следуем лучшим практикам, рекомендациям и т. д. Большая часть этого кода была написана, когда команда только начинала работу со Spring и Spring Boot. Код со временем развивался без рефакторинга и применения лучших практик. В конце концов, это вас настигнет, но мы используем это как опыт обучения и улучшения. Наши тестовые примеры теперь значительно лучше, и мы будем внимательно следить за их развитием.

Миграция Spring Boot на Java 17 — Резюме

Эта статья описывает нашу историю миграции и может отражать вашу историю, а может и не относиться к ней. В зависимости от версии Spring Boot, с которой вы работаете, используемых вами функций и модулей Spring, которые вы интегрируете в свои приложения, ваша миграция будет сильно отличаться.

В конце концов, миграция приложения на Java 17 был вопросом обновления нашей версии Spring Boot. Я уверен, что это не было сюрпризом для всех, но эта статья была про трудный, а не легкий путь.

Это так же просто и так же сложно, как поддерживать наши зависимости в актуальном состоянии. Мы знаем, что это лучшая практика, но это еще не сделано. Я хорошо понимаю. До прихода в кодоцентрическую компанию я почти 20 лет занимался разработкой продуктов и полностью понимал конкурирующие приоритеты. Если мы чему-то научились за последнюю неделю, так это тому, насколько мы зависимы и уязвимы от OSS. Очень важно иметь возможность быстро двигаться и быстро обновляться.

Мы должны привыкнуть к постоянному обновлению наших приложений и версий Spring Boot не реже одного раза в шесть месяцев. Процесс обновления более плавный при переходе от одной версии к другой, без пропуска версий. И имейте в виду, что версии Spring Boot поддерживаются около года до достижения EOL.

К счастью, есть инструменты для автоматизации этого процесса, такие как Dependabot, Renovate, Synk. Эти инструменты автоматически сканируют ваши зависимости, постоянно ищут новые версии и создают pull запросы, когда новая версия доступна. Если вы используете GitHub, скорее всего, вы уже знакомы с Dependabot.

Источник

[problem phenomenon]

When the springcloud system is built in the idea, a red error is prompted at runtime:


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 [[email protected]]

......

Caused by: java.lang.IllegalStateException: 
Failed to introspect Class 
[org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] 
from ClassLoader [[email protected]]

......

Caused by: java.lang.NoClassDefFoundError: 
org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata

......

Caused by: java.lang.ClassNotFoundException: 
org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

[reason]

This is a very common problem in the spring cloud system because the spring boot version is incompatible with the spring cloud version.

[solution]

The spring boot version and spring cloud version should be matched in strict accordance with the official version. Link to the official website:
https://spring.io/projects/spring-cloud

Different clouds need different boot versions, as shown in the figure:

Example of version change:

after version replacement, reload all Maven items, as shown in the figure:

If an error is still reported, re-execute the MVN clean package

Read More:

1. Purpose

In this post, I would demonstrate how to solve the following exception when using spring boot and alibaba nacos.

Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_121]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_121]
	at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_121]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.6.jar:5.3.6]
	... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
	... 42 common frames omitted

2. The solution

2.1 The details of the problem

Here is the details of the exception:

/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/bswen/JavaProjects/SpringCloudLearning202202/nacos-provider "-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-Dmaven.ext.class.path=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2019.3.3 org.springframework.boot:spring-boot-maven-plugin:2.4.5:run
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.example:nacos-provider:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.scope' for com.alibaba.cloud:spring-cloud-alibaba-dependencies:pom must be one of [provided, compile, runtime, test, system] but is 'import'. @ line 32, column 20
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ---------------------< org.example:nacos-provider >---------------------
[INFO] Building nacos-provider 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.4.5:run (default-cli) > test-compile @ nacos-provider >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ nacos-provider ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 14 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ nacos-provider ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/bswen/JavaProjects/SpringCloudLearning202202/nacos-provider/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ nacos-provider ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /Users/bswen/JavaProjects/SpringCloudLearning202202/nacos-provider/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ nacos-provider ---
[INFO] Changes detected - recompiling the module!
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.4.5:run (default-cli) < test-compile @ nacos-provider <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.4.5:run (default-cli) @ nacos-provider ---
[INFO] Attaching agents: []
2022-02-18 13:27:45.050  WARN 38570 --- [           main] s.c.a.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 [[email protected]]
2022-02-18 13:27:45.061  INFO 38570 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-18 13:27:45.096 ERROR 38570 --- [           main] o.s.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 [[email protected]]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) [spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) [spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) [spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) [spring-context-5.3.6.jar:5.3.6]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) [spring-boot-2.4.5.jar:2.4.5]
	at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_121]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.5.jar:2.4.5]
	at com.bswen.tapi.NacosProviderApplication.main(NacosProviderApplication.java:13) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [[email protected]]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.6.jar:5.3.6]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:294) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.3.6.jar:5.3.6]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_121]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_121]
	at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_121]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.6.jar:5.3.6]
	... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
	... 42 common frames omitted

2022-02-18 13:27:45.099 ERROR 38570 --- [           main] o.s.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 [[email protected]]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.4.5.jar:2.4.5]
	at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_121]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:375) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) [spring-boot-2.4.5.jar:2.4.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) [spring-boot-2.4.5.jar:2.4.5]
	at com.bswen.tapi.NacosProviderApplication.main(NacosProviderApplication.java:13) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [[email protected]]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.6.jar:5.3.6]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:294) ~[spring-context-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-5.3.6.jar:5.3.6]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.3.6.jar:5.3.6]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_121]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_121]
	at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_121]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.6.jar:5.3.6]
	... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
	... 42 common frames omitted

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.635 s
[INFO] Finished at: 2022-02-18T13:27:45+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.5:run (default-cli) on project nacos-provider: Application finished with exit code: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


2.2 The nacos and spring boot version

Our nacos version:

<dependency>
  <groupId>com.alibaba.cloud</groupId>
  <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  <version>2.1.3.RELEASE</version>
</dependency>

Our springboot version:

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.4.5</version>
  <relativePath/> <!-- lookup parent from repository -->
</parent>

2.3 The reason of the problem

According to nacos document, the version of nacos and springboot has some rules:

Version 2.1.x.RELEASE of nacos is compatible with the Spring Boot 2.1.x line. Version 2.0.x.RELEASE is compatible with the Spring Boot 2.0.x line. Version 1.5.x.RELEASE is compatible with the Spring Boot 1.5.x line.

So the key point is that our nacos version is not matching the spring boot version.

2.4 The solution of the problem

So the solution is very easy, we should change the version of springboot to 2.1.x:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.18.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Not it works!

3. Summary

In this post, I demonstrated how to solve “java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata” problem when using nacos and springboot, the key point is to match their versions. That’s it, thanks for your reading.

What is Bean Creation exception?-error creating bean with name

error creating bean with name,What is Bean Creation exception?,What is unsatisfied dependency exception?,Is org Springframework beans factory,NoSuchBeanDefinitionException?,How do I create a new bean?,error creating bean with name defined in file,error creating bean,with name spring boot,error creating bean with name'configurationpropertiesbeans',

error creating bean with name,What is Bean Creation exception?,What is unsatisfied dependency exception?,Is org Springframework beans factory,NoSuchBeanDefinitionException?,How do I create a new bean?,error creating bean with name defined in file,error creating bean,with name spring boot,error creating bean with name’configurationpropertiesbeans’,

If you’re mistreatment the Spring framework in your Java application and obtaining this error throughout startup it means Spring isn’t able to initialize the bean X and add it into its application context, Why? There might be multiple reasons sort of a typographical error on the spring bean name. Let’s take a more in-depth examine the stack trace to search out out the $64000 reason:

BeanInstantiationException: couldn’t instantiate bean category [X]: No default builder found; nested exception is java.lang.NoSuchMethodException: X.()

Here X is that the category, that is asserted as Spring bean. The error clearly says that the default builder isn’t gift at school X.

By default, Spring can attempt to instantiate beans by job the default or no-argument constructor and if it does not notice the default, no-argument builder then it’s ineffectual to initialize the bean and thus it throws the BeanInstantiationException during startup,additionally appended into stack trace as NoSuchMethodException.

If you bear in mind, Java by default adds a default builder in each category however several programmers do not know that it solely will that if you do not have any builder within the category if by any probability you’ve got outlined a builder that takes a parameter, then Java won’t add it.

This is conjointly one among the explanations I suggest always add a default builder within the Java category, notwithstanding whether or not you’ve got additional constructors or not. Java permits builder overloading and you must cash in of that.

I conjointly counsel you undergo a comprehensive Spring on-line coaching course to grasp however Spring works, however it instantiates objects, wherever will it keep the item reference, dependency injection, IOC instrumentation, and far additional.

If you wish a recommendation then I counsel you be part of one among the courses during this list of best Spring courses for Java developers. It’s one among the foremost up-to-date resources to be told in Spring and covers Spring five.0 and Reactive Programming yet. 

error creating bean with name,What is Bean Creation exception?,What is unsatisfied dependency exception?,Is org Springframework beans factory,NoSuchBeanDefinitionException?,How do I create a new bean?,error creating bean with name defined in file,error creating bean,with name spring boot,error creating bean with name'configurationpropertiesbeans',

error creating bean with name,What is Bean Creation exception?,What is unsatisfied dependency exception?,Is org Springframework beans factory,NoSuchBeanDefinitionException?,How do I create a new bean?,error creating bean with name defined in file,error creating bean,with name spring boot,error creating bean with name'configurationpropertiesbeans',

error creating bean with name,What is Bean Creation exception?,What is unsatisfied dependency exception?,Is org Springframework beans factory,NoSuchBeanDefinitionException?,How do I create a new bean?,error creating bean with name defined in file,error creating bean,with name spring boot,error creating bean with name'configurationpropertiesbeans',

Btw, if you’re mistreatment XML based mostly configuration then certify you’re mistreatment the proper builder on your config.

. It does not say something concerning the error, that is why you wish to appear at the nested exception to search out the particular cause.

For example, during this case, the nested error was BeanInstantiationException, that indicates the internal representation of a bean unsuccessful.

You should continuously concentrate to elaborated stack trace because it conjointly carries the violative bean category and reason like during this case, it absolutely was making an attempt to instantiate bean by invoking default builder and could not notice it.

By observing the error, you’ll conclude that whether or not you wish to feature a default builder or Spring is invoking a wrong constructor, which implies a missing config somehow.

Sometimes BeanInstantiationException is conjointly throwing in Spring isn’t able to notice the bean category within the classpath. that point you’ll see either NoClassDefFoundError or ClassNotFoundException as a nested exception within the stack trace.

Ошибка Создание боба с именем ‘ConfigurationPropertiesBeans’ определено в аномальном анализе ресурса класса.

В процессе обучения использованию NACO Alibaba я написал демо -версию Spring Cloud для реализации регистрации услуг. Как только проект был запущен, были зарегистрированы следующие исключения:

2020-12-15 12:50:43.215  WARN 24520 --- [           main] s.c.a.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 [[email protected]]
2020-12-15 12:50:43.222  INFO 24520 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-15 12:50:43.240 ERROR 24520 --- [           main] o.s.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 [[email protected]]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:586) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) [spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) [spring-context-5.3.2.jar:5.3.2]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at java.util.ArrayList.forEach(Unknown Source) ~[na:1.8.0_144]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at com.wongoing.NacosServer1Application.main(NacosServer1Application.java:16) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [[email protected]]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.2.jar:5.3.2]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:294) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1100) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.3.2.jar:5.3.2]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_144]
	at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[na:1.8.0_144]
	at java.lang.Class.getDeclaredMethods(Unknown Source) ~[na:1.8.0_144]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.2.jar:5.3.2]
	... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_144]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	... 42 common frames omitted

2020-12-15 12:50:43.242 ERROR 24520 --- [           main] o.s.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 [[email protected]]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:586) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:244) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:767) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:572) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:212) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:117) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:74) ~[spring-cloud-context-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at java.util.ArrayList.forEach(Unknown Source) ~[na:1.8.0_144]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62) ~[spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) [spring-boot-2.4.2-SNAPSHOT.jar:2.4.2-SNAPSHOT]
	at com.wongoing.NacosServer1Application.main(NacosServer1Application.java:16) [classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans] from ClassLoader [[email protected]]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.3.2.jar:5.3.2]
	at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:294) ~[spring-context-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1100) ~[spring-beans-5.3.2.jar:5.3.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.3.2.jar:5.3.2]
	... 31 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_144]
	at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[na:1.8.0_144]
	at java.lang.Class.getDeclaredMethods(Unknown Source) ~[na:1.8.0_144]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.2.jar:5.3.2]
	... 38 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
	at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_144]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_144]
	... 42 common frames omitted

Благодаря тщательному чтению руководства NACOS и анализе POM.XML, обнаружено, что версия Spring-Boot не соответствует версии NACOS.

Оригинальный pom.xml выглядит следующим образом:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.1-SNAPSHOT</version>
	</parent>
	<groupId>wongoing</groupId>
	<artifactId>nacos</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>NacosServer-1</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		
		<dependency>
		    <groupId>com.alibaba.cloud</groupId>
		    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
		    <version>2.2.3.RELEASE</version>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
		</repository>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
		</pluginRepository>
		<pluginRepository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>

</project>

Из-за проекта Spring Boot, непосредственно созданного Spring Tool Suite 4, самая высокая версия составляет 2.4.1-Snapshot, а самая высокая версия текущего NACO-2.2.3.reease, так как дольше версия Spring Boot Сниженная до NACO, версия является последовательной.

Модифицированный pom.xml выглядит следующим образом:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.3.RELEASE</version>
	</parent>
	<groupId>wongoing</groupId>
	<artifactId>nacos</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>NacosServer-1</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		
		<dependency>
		    <groupId>com.alibaba.cloud</groupId>
		    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
		    <version>2.2.3.RELEASE</version>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
		</repository>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
		</pluginRepository>
		<pluginRepository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>

</project>

После начала вы можете увидеть эту услугу в списке услуг интерфейса управления NACOS. Как показано ниже:

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error creating acrobat printer style
  • Error createservice error 0x421
  • Error createprocess error 216
  • Error createbot failed cs go
  • Error create thumbnail image joomshopping

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии