spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support
https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
Apache License 2.0
2.74k stars 356 forks source link

Request to add native support for Feign Reactive #1718

Closed wenqiglantz closed 1 year ago

wenqiglantz commented 1 year ago

Hi, I am trying to add Spring Native (version 0.12.1) to my Spring Boot app (version 2.7.3) with Feign Reactive. I am running into issues with configuring native hints for Feign Reactive. I have tried adding the following content into META-INF\native-image\<my group id>\<my artifact id>\reflect-config.json, but it didn't work, upon app startup, I got error complaining the bean definition for my DemoClient class, which is annotated with @ReactiveFeignClient, couldn't be found.

[
  {
    "name": "reactivefeign.spring.config.ReactiveFeignAutoConfiguration",
    "allDeclaredMethods": true,
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allDeclaredClasses": true,
    "allPublicClasses": true,
    "allPublicConstructors": true,
    "allPublicFields": true,
    "allPublicMethods": true
  }
]

I have also tried annotating NativeHint in my main app class DemoApplication, but it didn't work either, same error.

@SpringBootApplication
@EnableReactiveFeignClients
@NativeHint(
        trigger = ReactiveFeignClient.class,
        types = {
                @TypeHint(types = ReactiveFeignAutoConfiguration.class,
                access = { TypeAccess.DECLARED_METHODS, TypeAccess.DECLARED_FIELDS,
                        TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
                        TypeAccess.PUBLIC_CLASSES, TypeAccess.PUBLIC_CONSTRUCTORS,
                        TypeAccess.PUBLIC_FIELDS, TypeAccess.PUBLIC_METHODS
                })
        }
)
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

I'd like to know what I am missing in properly configuring native hints for Feign Reactive. Any chance Feign Reactive native support can be incorporated into future release of Spring Native?

Thanks, Wenqi

sdeleuze commented 1 year ago

First be aware that we are transitioning from Spring Native which brings experimental native support for Spring Boot 2.x to Spring Boot 3 and Spring Framework 6 who are going to provide official out of the box support for native, the release is expected late november.

I would advise to begin migrating it to Spring Boot 3 / Spring Framework 6 to see if it work out of the box, and if not, adding missing hints on Feign Reactive side since it is an external project. Maybe create a related issue on https://github.com/PlaytikaOSS/feign-reactive side and ping me if you need guidance.