micronaut-projects / micronaut-discovery-client

Micronaut's Discovery Client
Apache License 2.0
22 stars 20 forks source link

No bean introspection available for type [class io.micronaut.discovery.spring.config.client.ConfigServerResponse] #652

Open AndreyIvanovDev opened 2 weeks ago

AndreyIvanovDev commented 2 weeks ago

Expected Behavior

Sussessfully run application

Actual Behaviour

Have an error

Steps To Reproduce

Hello! I get an error when setting up distributed config with spring cloud config server:

build.gradle.kts

plugins {
    id("com.github.johnrengelman.shadow") version "8.1.1"
    id("io.micronaut.application") version "4.4.2"
    id("io.micronaut.aot") version "4.4.2"
}

version = "0.1"
group = "ru.mvideo"

repositories {
    mavenCentral()
}

dependencies {
    annotationProcessor("io.micronaut:micronaut-http-validation")
    annotationProcessor("io.micronaut.security:micronaut-security-annotations")
    annotationProcessor("io.micronaut.serde:micronaut-serde-processor")
    implementation("io.micronaut:micronaut-http-client")
    implementation("io.micronaut.discovery:micronaut-discovery-client")
    implementation("io.micronaut.serde:micronaut-serde-jackson")
    runtimeOnly("ch.qos.logback:logback-classic")
    runtimeOnly("org.yaml:snakeyaml")
    aotPlugins(platform("io.micronaut.platform:micronaut-platform:4.6.3"))
}

application {
    mainClass = "ru.mvideo.assortment.Application"
}
java {
    sourceCompatibility = JavaVersion.toVersion("21")
    targetCompatibility = JavaVersion.toVersion("21")
}

graalvmNative.toolchainDetection = false

micronaut {
    runtime("netty")
    testRuntime("junit5")
    processing {
        incremental(true)
        annotations("ru.mvideo.assortment.*")
    }
    aot {
        // Please review carefully the optimizations enabled below
        // Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details
        optimizeServiceLoading = false
        convertYamlToJava = false
        precomputeOperations = true
        cacheEnvironment = true
        optimizeClassLoading = true
        deduceEnvironment = true
        optimizeNetty = true
        replaceLogbackXml = true
        configurationProperties.put("micronaut.security.jwks.enabled", "false")
        configurationProperties.put("micronaut.security.openid-configuration.enabled", "false")
    }
}

tasks.named<io.micronaut.gradle.docker.NativeImageDockerfile>("dockerfileNative") {
    jdkVersion = "21"
}

bootstrap.yml

micronaut:
  application:
    name: app-auth-proxy
  config-client:
    enabled: true
spring:
  cloud:
    config:
      enabled: true
      uri: http://localhost:7777
      retry-attempts: 4
      retry-delay: 2s

When I run the application I get an error:

15:17:39.518 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Error reading distributed configuration from Spring Cloud: Client 'http://localhost:7777': Error decoding HTTP response body: No bean introspection available for type [class io.micronaut.discovery.spring.config.client.ConfigServerResponse]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected
io.micronaut.context.exceptions.ConfigurationException: Error reading distributed configuration from Spring Cloud: Client 'http://localhost:7777': Error decoding HTTP response body: No bean introspection available for type [class io.micronaut.discovery.spring.config.client.ConfigServerResponse]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected
    at io.micronaut.discovery.spring.config.SpringCloudConfigurationClient.lambda$getPropertySources$0(SpringCloudConfigurationClient.java:130)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
    at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2236)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:612)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:592)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.innerError(FluxFlatMap.java:867)
    at reactor.core.publisher.FluxFlatMap$FlatMapInner.onError(FluxFlatMap.java:994)
    at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
    at reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapInner.onError(FluxSwitchMapNoPrefetch.java:517)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
    at reactor.core.publisher.Operators.error(Operators.java:198)
    at reactor.core.publisher.FluxError.subscribe(FluxError.java:43)
    at reactor.core.publisher.Flux.subscribe(Flux.java:8848)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
    at reactor.core.publisher.SerializedSubscriber.onError(SerializedSubscriber.java:124)
    at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.onError(FluxTimeout.java:220)
    at reactor.core.publisher.MonoNext$NextSubscriber.onError(MonoNext.java:93)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onError(MonoFlatMapMany.java:256)
    at reactor.core.publisher.FluxCreate$BaseSink.error(FluxCreate.java:479)
    at reactor.core.publisher.FluxCreate$BufferAsyncSink.drain(FluxCreate.java:868)
    at reactor.core.publisher.FluxCreate$BufferAsyncSink.error(FluxCreate.java:813)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.drainLoop(FluxCreate.java:239)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.drain(FluxCreate.java:215)
    at reactor.core.publisher.FluxCreate$SerializedFluxSink.error(FluxCreate.java:191)
    at io.micronaut.http.client.netty.ForwardingSubscriber.onError(ForwardingSubscriber.java:50)
    at io.micronaut.http.client.netty.NettyFuturePublisher$1.lambda$request$0(NettyFuturePublisher.java:57)
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557)
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
    at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
    at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629)
    at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.lambda$forwardResponseToPromise$1(DefaultHttpClient.java:2222)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.makeNormalBodyParseError(DefaultHttpClient.java:2299)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.forwardResponseToPromise(DefaultHttpClient.java:2221)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.channelReadInstrumented(DefaultHttpClient.java:2181)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.channelReadInstrumented(DefaultHttpClient.java:2149)
    at io.micronaut.http.client.netty.SimpleChannelInboundHandlerInstrumented.channelRead0(SimpleChannelInboundHandlerInstrumented.java:46)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:1583)
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104)
        at reactor.core.publisher.Mono.block(Mono.java:1779)
        at io.micronaut.discovery.client.config.DistributedPropertySourceLocator.findPropertySources(DistributedPropertySourceLocator.java:79)
        at io.micronaut.context.DefaultApplicationContext$RuntimeConfiguredEnvironment.readPropertySourceList(DefaultApplicationContext.java:970)
        at io.micronaut.context.env.DefaultEnvironment.readPropertySources(DefaultEnvironment.java:439)
        at io.micronaut.context.env.DefaultEnvironment.start(DefaultEnvironment.java:277)
        at io.micronaut.context.DefaultApplicationContext$RuntimeConfiguredEnvironment.start(DefaultApplicationContext.java:956)
        at io.micronaut.context.DefaultApplicationContext$RuntimeConfiguredEnvironment.start(DefaultApplicationContext.java:925)
        at io.micronaut.context.DefaultApplicationContext.startEnvironment(DefaultApplicationContext.java:279)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:214)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:75)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:334)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:320)
        at ru.mvideo.assortment.Application.main(Application.java:14)
Caused by: io.micronaut.http.client.exceptions.HttpClientResponseException: Client 'http://localhost:7777': Error decoding HTTP response body: No bean introspection available for type [class io.micronaut.discovery.spring.config.client.ConfigServerResponse]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.makeNormalBodyParseError(DefaultHttpClient.java:2289)
    ... 40 common frames omitted
Caused by: io.micronaut.core.beans.exceptions.IntrospectionException: No bean introspection available for type [class io.micronaut.discovery.spring.config.client.ConfigServerResponse]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected
    at io.micronaut.core.beans.BeanIntrospector.lambda$getIntrospection$3(BeanIntrospector.java:116)
    at java.base/java.util.Optional.orElseThrow(Optional.java:403)
    at io.micronaut.core.beans.BeanIntrospector.getIntrospection(BeanIntrospector.java:116)
    at io.micronaut.serde.support.DefaultSerdeIntrospections.lambda$getDeserializableIntrospection$3(DefaultSerdeIntrospections.java:158)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at io.micronaut.serde.support.DefaultSerdeIntrospections.getDeserializableIntrospection(DefaultSerdeIntrospections.java:149)
    at io.micronaut.serde.support.deserializers.ObjectDeserializer.createDeserBean(ObjectDeserializer.java:173)
    at io.micronaut.serde.support.deserializers.ObjectDeserializer.lambda$getDeserializableBean$1(ObjectDeserializer.java:163)
    at io.micronaut.core.util.SupplierUtil$2.get(SupplierUtil.java:79)
    at io.micronaut.serde.support.deserializers.ObjectDeserializer.getDeserializableBean(ObjectDeserializer.java:164)
    at io.micronaut.serde.support.deserializers.ObjectDeserializer.createSpecific(ObjectDeserializer.java:90)
    at io.micronaut.serde.jackson.JacksonJsonMapper.readValue0(JacksonJsonMapper.java:248)
    at io.micronaut.serde.jackson.JacksonJsonMapper.readValue(JacksonJsonMapper.java:238)
    at io.micronaut.serde.jackson.JacksonJsonMapper.readValue(JacksonJsonMapper.java:298)
    at io.micronaut.json.body.JsonMessageHandler.read(JsonMessageHandler.java:104)
    at io.micronaut.http.netty.body.NettyJsonHandler.read(NettyJsonHandler.java:110)
    at io.micronaut.http.client.netty.FullNettyClientHttpResponse.convertByteBuf(FullNettyClientHttpResponse.java:224)
    at io.micronaut.http.client.netty.FullNettyClientHttpResponse.lambda$getBody$0(FullNettyClientHttpResponse.java:172)
    at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228)
    at io.micronaut.http.client.netty.FullNettyClientHttpResponse.getBody(FullNettyClientHttpResponse.java:167)
    at io.micronaut.http.client.netty.FullNettyClientHttpResponse.<init>(FullNettyClientHttpResponse.java:106)
    at io.micronaut.http.client.netty.DefaultHttpClient$FullHttpResponseHandler.forwardResponseToPromise(DefaultHttpClient.java:2204)
    ... 39 common frames omitted

before it have config successfully

15:17:39.465 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - HTTP Client Response Received (200 ) for Request: GET http://localhost:7777/app-auth-proxy/default
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - Content-Type: application/json
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - Date: Thu, 07 Nov 2024 12:17:39 GMT
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - Keep-Alive: timeout=60
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - Connection: keep-alive
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - content-length: 530
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - Response Body
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - ----
15:17:39.466 [default-nioEventLoopGroup-1-1] TRACE i.m.h.client.netty.DefaultHttpClient - {"name":"app-auth-proxy","profiles":["default"],"label":null,"version":"72c7e33a4feb241bc712121452b4990e76e0f98f","state":null,"propertySources":[{"name":"https://gitlab.tech.mvideo.ru/mvideoru/dbue/general/assortment2/ascommon/as-proj-app-configs.git/app-auth-proxy/application.yml","source":{"micronaut.application.name":"app-auth-proxy","app.variable":"hello"}},{"name":"https://gitlab.tech.mvideo.ru/mvideoru/dbue/general/assortment2/ascommon/as-proj-app-configs.git/application.yml","source":{"micronaut.server.port":8282}}]}

Thank you.

Environment Information

Example Application

No response

Version

4.6.3