0

There is a separate Spring boot api (as AOP Api) (e.i creez-aop-service )for logging which is used for another Spring boot services (e.i creez-main-service) via a common api (e.i creez-common-service)

The Spring Boot version has been upgraded to 2.6.4 for these two services e.i

  • creez-main-service
  • creez-common-service

While the AOP service is still in its old version e.i 2.1.4.RELEASE

  • creez-aop-service

And because this aop service (creez-aop-service) is currently using in some another module therefor we can’t upgrade this aop service at this point of time. what to use same aop service in my all upgraded services

How can I consume this creez-aop-service (of older version 2.1.4.RELEASE) in my upgraded spring boot module (of version 2.6.4)?

When I use this I got following exception :

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 36 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration.configurationPropertiesBeans(ConfigurationPropertiesRebinderAutoConfiguration.java:56)
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a8e43f25.CGLIB$configurationPropertiesBeans$1(<generated>)
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a8e43f25$$FastClassBySpringCGLIB$$b00bd25d.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a8e43f25.configurationPropertiesBeans(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata
    at java.net.URLClassLoader.findClass(URLClassLoader.java:591)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:953)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:898)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:881)
    ... 48 common frames omitted
Jimmy
  • 995
  • 9
  • 18
  • Issue appears to be not AOP related . Do go through the stackoverflow [Q&A](https://stackoverflow.com/q/65488101/4214241) – R.G Jul 05 '22 at 15:17
  • Thanks @R.G I got the solution and also added the answer here as well – Jimmy Jul 06 '22 at 06:05

1 Answers1

0

I have fixed this solution as per the suggestion here Spring Cloud and it is working for me

The issue was related to spring cloud version by adding following tag in pom.xml

    <properties>
        <spring-cloud.version>2021.0.1</spring-cloud.version>
    </properties>

    <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>
Jimmy
  • 995
  • 9
  • 18