I am in the process of migrating my project from Java 11 to Java 21 and from Micronaut 2.1.3 to Micronaut 4.2.2. My project includes the following interface responsible for retrieving data in the FeatureCollection format:
@Retryable(attempts = "5", delay = "2s")
@Client("http://X.X.X.X/data")
public interface ServerClient {
@Get("")
FeatureCollection getLayer();
}
My class responsible for fetching the FeatureCollection:
@Singleton
class MyManager {
private final Supplier<FeatureCollection> layerSupplier;
@Inject
MyManager(ServerClient serverClient) {
this.layerSupplier = serverClient::getLayer;
}
@EventListener
void onStartupEvent(StartupEvent startupEvent) {
FeatureCollection fc = layerSupplier.get();
}
}
After upgrading the Java and Micronaut versions, I encounter the following error:
io.micronaut.http.client.exceptions.HttpClientResponseException: Client 'http://X.X.X.X/data': Error decoding HTTP response body: No bean introspection available for type [class mil.nga.sf.geojson.FeatureCollection]. Ensure the class is annotated with io.micronaut.core.annotation.Introspected
Dependency for FeatureCollection:
<dependency>
<groupId>mil.nga.sf</groupId>
<artifactId>sf-geojson</artifactId>
<version>3.3.2</version>
</dependency>
I haven't found an effective way to avoid this error during testing.