Describe the bug I read that starting spring-cloud 2022.0.0, you can use native compilation. I'm using 2022.0.2 (spring-cloud-starter-openfeign:4.0.2), but when I use an OpenFeign client with native compilation, I get the following error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'boxedHelloController': Unsatisfied dependency expressed through field 'helloWorldClient': Error creating bean with name 'nl.cqit.function.poc.java.helloworld.controller.HelloWorldClient': Post-processing of FactoryBean's singleton object failed
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:195) ~[na:na]
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveAndSet(AutowiredFieldValueResolver.java:167) ~[na:na]
        at nl.cqit.function.poc.java.boxedhello.controller.BoxedHelloController__Autowiring.apply(BoxedHelloController__Autowiring.java:15) ~[na:na]
        at org.springframework.beans.factory.support.InstanceSupplier$1.get(InstanceSupplier.java:83) ~[na:na]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[boxedhello-app.exe:3.0.5]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[boxedhello-app.exe:3.0.5]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[boxedhello-app.exe:3.0.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[boxedhello-app.exe:3.0.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[boxedhello-app.exe:3.0.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[boxedhello-app.exe:3.0.5]
        at nl.cqit.function.poc.java.boxedhello.Main.main(Main.java:12) ~[boxedhello-app.exe:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.cqit.function.poc.java.helloworld.controller.HelloWorldClient': Post-processing of FactoryBean's singleton object failed
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:108) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1823) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1273) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:259) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1640) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1597) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:189) ~[na:na]
        ... 22 common frames omitted
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface nl.cqit.function.poc.java.helloworld.controller.HelloWorldClient, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:171) ~[na:na]
        at java.base@19.0.2/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47) ~[boxedhello-app.exe:na]
        at java.base@19.0.2/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037) ~[boxedhello-app.exe:na]
        at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:123) ~[na:na]
        at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[na:na]
        at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:127) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1885) ~[boxedhello-app.exe:6.0.7]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:105) ~[boxedhello-app.exe:6.0.7]
        ... 32 common frames omitted

Sample Here is my API:

package nl.cqit.function.poc.java.helloworld.api;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import nl.cqit.function.poc.java.helloworld.api.model.Person;
import nl.cqit.function.poc.java.helloworld.api.model.Problem;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;

@Validated
@Tag(
    name = "HelloWorld",
    description = "the HelloWorld API"
)
public interface HelloWorldApi {
    @Operation(
        operationId = "sayHello",
        summary = "The main function",
        description = "This endpoint will call sayHello",
        tags = {"HelloWorld"},
        responses = {@ApiResponse(
    responseCode = "200",
    description = "OK",
    content = {@Content(
    mediaType = "application/json",
    schema = @Schema(
    implementation = String.class
)
), @Content(
    mediaType = "application/problem+json",
    schema = @Schema(
    implementation = String.class
)
)}
), @ApiResponse(
    responseCode = "400",
    description = "input validation failed",
    content = {@Content(
    mediaType = "application/json",
    schema = @Schema(
    implementation = Problem.class
)
), @Content(
    mediaType = "application/problem+json",
    schema = @Schema(
    implementation = Problem.class
)
)}
)}
    )
    @RequestMapping(
        method = {RequestMethod.POST},
        value = {"/helloWorld"},
        produces = {"application/json", "application/problem+json"},
        consumes = {"application/json"}
    )
    @ResponseStatus(HttpStatus.OK)
    String sayHello(@Parameter(name = "Person",description = "",required = true) @RequestBody @Valid Person var1);
}

And here is my Feign client:

package nl.cqit.function.poc.java.helloworld.controller;

import nl.cqit.function.poc.java.helloworld.api.HelloWorldApi;
import org.springframework.cloud.openfeign.FeignClient;

@FeignClient(name = "helloWorldClient", url = "http://localhost:8080")
public interface HelloWorldClient extends HelloWorldApi {
}

I'm using it like this:

package nl.cqit.function.poc.java.boxedhello.impl;

import nl.cqit.function.poc.java.boxedhello.api.BoxedHelloApi;
import nl.cqit.function.poc.java.boxedhello.api.model.Person;
import nl.cqit.function.poc.java.helloworld.controller.HelloWorldClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BoxedHelloImpl implements BoxedHelloApi {

    @Autowired
    private HelloWorldClient helloWorldClient;

    @Override
    public String sayHello(Person person) {
        String greeting = helloWorldClient.sayHello(map(person));
        String horizontalEdge = "+" + "-".repeat(greeting.length() + 2) + "+";
        return horizontalEdge + "\n| " + greeting + " |\n" + horizontalEdge;
    }

    private nl.cqit.function.poc.java.helloworld.api.model.Person map(Person person) {
        return new nl.cqit.function.poc.java.helloworld.api.model
                .Person(person.getFirstName())
                .lastName(person.getLastName());
    }
}

With this as my Main class:

package nl.cqit.function.poc.java.boxedhello;

import nl.cqit.function.poc.java.helloworld.controller.HelloWorldClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

@EnableFeignClients(basePackageClasses = {HelloWorldClient.class})
@SpringBootApplication
public class Main {
    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }
}

Using this profile for native compilation in my pom.xml:

<profiles>
        <profile>
            <id>native</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <image>
                                <builder>paketobuildpacks/builder:tiny</builder>
                                <env>
                                    <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
                                </env>
                            </image>
                        </configuration>
                        <executions>
                            <execution>
                                <id>process-aot</id>
                                <goals>
                                    <goal>process-aot</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <configuration>
                            <classesDirectory>${project.build.outputDirectory}</classesDirectory>
                            <metadataRepository>
                                <enabled>true</enabled>
                            </metadataRepository>
                            <requiredVersion>22.3</requiredVersion>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-native</id>
                                <goals>
                                    <goal>compile-no-fork</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                            <execution>
                                <id>add-reachability-metadata</id>
                                <goals>
                                    <goal>add-reachability-metadata</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

Is this a bug or am I missing something?

Comment From: Rocker93

This issue started occurring after upgrading to Spring Boot 3.0.6 from 3.0.5 so it seems to be some regression bug. Unfortunately I have not been able to track down what causes it.

Comment From: CC007

I was able to get somewhat further when manually adding the aot hint for a proxy for the client interface. It now allows the application to start, albeit slowly, due to a missing resource (not at my pc atm. I'll post the specific logs later), but it can't find the HttpMessageConverter when trying to use the client. I'll see if I can make a public git repo available demonstrating the issues, when I have time.

Comment From: CC007

@Rocker93 I am actually using 3.0.5

Comment From: OlgaMaciaszek

Hello, @CC007 @Rocker93 , if you could provide a link to a sample, that would be helpful. We do have a working sample here. I will look into the code you've provided anyway, but will need some time as we have various issues queued up at this point.

Comment From: CC007

@OlgaMaciaszek I made my repo public for now. You can find it here: https://github.com/CodeQualIT/CQITFunctions

Comment From: OlgaMaciaszek

Thanks a lot, @CC007. Should be able to get to it around 8th of May.

Comment From: CC007

No problem. If you have any questions, feel free to reply here or message me on Discord: cc007#2753

Comment From: CC007

Also, one thing I noticed is that when org.springframework.cloud.client.HostInfoEnvironmentPostProcessor is trying to get the config for spring.cloud.inetutils, used in the instantiation of org.springframework.cloud.commons.util.InetUtils on line 60 of the post processor, that the config isn't loaded correctly.

InetUtils in org.springframework.cloud.commons.util.UtilAutoConfiguration doesn't seem to have the same issue, because that one seems to get fully initialized before use.

This leads to a significant startup delay, because I'm using a vEthernet (External switch) adapter from hyper-v to route my internet (this was needed to get LAN IP addresses for my hyper-v VMs). Adding...

spring:
  cloud:
    inetutils:
      preferred-networks:
        - 192.168

...should have fixed this, but due to the config not getting picked up in the post processor, the startup delay is not prevented.

This happened even without native compilation.

Comment From: CC007

I think the issue in my previous comment is out of scope, so I created an issue in the appropriate issue tracker: https://github.com/spring-cloud/spring-cloud-commons/issues/1233

Comment From: CC007

FYI: I manually added https://github.com/CodeQualIT/CQITFunctions/blob/master/pocs/boxedhello-project/boxedhello-generated/boxedhello-clients/boxedhello-helloworld-client/src/main/java/nl/cqit/function/poc/java/boxedhello/services/helloworld/HelloWorldServiceRuntimeHints.java as a partial workaround. This makes it so that the application starts, but it still causes issues when calling the client. Also, I'd expect these runtime hints for feign clients to be automatically added by openfeign, without user intervention.

Comment From: OlgaMaciaszek

Hello @CC007 , I've tried running the project, but the HelloWorldApi class is not available, so it does not compile. Please provide a minimal, executable sample that we can run and debug.

Comment From: OlgaMaciaszek

Probably caused by Spring Boot issue: https://github.com/spring-projects/spring-boot/issues/35397.

Comment From: CC007

Hello @CC007 , I've tried running the project, but the HelloWorldApi class is not available, so it does not compile. Please provide a minimal, executable sample that we can run and debug.

There are 2 projects in the poc folder: helloworld and boxedhello. Boxedhello uses the interface of helloworld to create a feign client.

I now created a 3rd project in the poc folder with the amount of modules reduced and with the helloworld interface added as submodule, so that it can be built independently.

Comment From: OlgaMaciaszek

Thanks, @CC007.

It seems 2 different issues have been discussed here. @Rocker93 if you have a project not working with Boot 3.0.6, but working with Boot 3.0.5, it's probably the regression I've linked above, and your project should work again on the newest Boot snapshots and Boot 3.0.7.

The second issue is the one present in the project @CC007 has linked. This issue seems specifically linked to the use of AOP alongside OpenFeign. I was able to reproduce it. Looks like a bug.

Comment From: CC007

The question is: is this one bug or 2 bugs?

The fact that I manually have to add the runtime hint is one bug, but I don't know if the errors I get related to HttpMessageConverter after manually adding the hints is the same bug or a second bug.

Is that one also caused by a missing runtime hints?

Comment From: CC007

Any progress regarding this issue?

Comment From: OlgaMaciaszek

@CC007 I will work on it this week or at the beginning of the next week.

Comment From: korkutkose

Any progress on this? We are having the same issue on one of our apps with boot 3.0.7, spring-cloud 2022.0.3 and native-maven-plugin 0.9.23.

Comment From: OlgaMaciaszek

Hi @korkutkose, it's high on the priority list. Should be able to handle it before we next release.

Comment From: CC007

@OlgaMaciaszek which release will that be? Are you referring to the next spring-cloud-openfeign release? Or the spring-cloud project in general?

Comment From: OlgaMaciaszek

They usually go hand in hand, unless there's a security patch. So it would be this one: https://github.com/spring-cloud/spring-cloud-release/milestone/137. If we get to the bug before it, we can release an OF only patch, but the Spring Cloud Train milestone is where it's scheduled.

Comment From: OlgaMaciaszek

Hello @CC007, as I've started working on this issue, I have created a proper minimal sample (with only Spring Web, Spring Cloud and Spring AOP), without any code generation or unnecessary non Spring-dependencies. I have set a Spring Boot parent, which is necessary for our integrations to work, have disabled spring.cloud.refresh, which required for GraalVM support and have upgraded to the most recent Boot 3.0.x and Cloud 2022.0.x dependencies. There don't seem to be any issues after fixing the Spring Boot setup and upgrading the dependencies. To test, follow instructions in the README file.

Comment From: OlgaMaciaszek

@korkutkose if you're still having issues after upgrading to Boot 3.0.8 and Cloud 2022.0.3, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: CC007

@OlgaMaciaszek thanks for taking a look at it. I'm going to see if I can get it working now too.

Since using dependency management rather than a parent is a valid use case when using Spring Boot, what specifically is defined in the parent that is needed to get native compilation to work?

Comment From: OlgaMaciaszek

It's expected to use both the parent and dependency management in a Spring Boot app.

Comment From: CC007

You can also use Spring boot without the starter parent: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#using.import

Comment From: CC007

I tried your minimal example (slightly modified, but in essence the same). When using Spring Boot 3.0.5 and Spring Cloud 2022.0.2, the example does now work. There are 2 things though:

  • I can't get it to work with Spring Boot 3.0.8 and Spring Cloud 2022.0.3. It gives the following error ``` [2/7] Performing analysis... [*] (9,8s @ 1,30GB) 7.357 (80,71%) of 9.115 classes reachable 8.741 (53,83%) of 16.237 fields reachable 28.915 (46,47%) of 62.222 methods reachable 583 classes, 305 fields, and 4.493 methods registered for reflection 4 native libraries: crypt32, ncrypt, psapi, winhttp

Error: Virtual threads are used in code, but are not currently available or active. Use JDK 19 with preview features enabled (--enable-preview). No code is changed compared to the spring boot `3.0.5` test. I tested it with `java.version` being 17 and 19. Both give the same error. - The runtime hints in `HelloWorldServiceRuntimeHints` seem to still be required. Without them, I get an error on runtime: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'boxedHelloController': Unsatisfied dependency expressed through field 'helloWorldService': Error creating bean with name 'nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService': Post-processing of FactoryBean's singleton object failed at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:195) ~[na:na] ... Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService': Post-processing of FactoryBean's singleton object failed at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:108) ~[boxedhello-minimal-app.exe:6.0.7] ... Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.DecoratingProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles= and -H:DynamicProxyConfigurationResources= options. at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89) ~[na:na] ``` I would have expected OpenFeign to add those dynamically at compile time.

Comment From: CC007

Hmm, after applying your suggestions, when I run with the project with my branch, I do still get the following error:

Could not write request: no suitable HttpMessageConverter found for request type [nl.cqit.function.poc.java.helloworld.api.model.Person] and content type [application/json]

It seems that yours was unfortunately too minimal to reproduce the issue. I'll see if I can find a middle ground where the code base is minimalized, but the issue still occurs.

Comment From: OlgaMaciaszek

Hi @CC007. Thanks for the update. You're right. I thought you might have misconfigured Graal plugin (you don't need to use the Boot parent, but then you need to make sure any build plugins, including Graal are configured correctly and updated if necessary when switching to a newer Boot version).

The problem seems to be that while we register any @FeignClient-annotated interfaces for reflection an proxying, we don't do it with any supertypes. I'll work on fixing it.

In the meantime, as a workaround, you can add @RegisterReflectionForBinding(BoxedHelloApi.class) over nl.cqit.function.poc.java.boxedhello.Main to make it execute correctly.

Comment From: CC007

For my usecase I eventually want to support the user being able to provide their own parent, but for now for the MVP of my software using the spring boot parent should be enough. Once that MVP is finished I'll see if I can find the issue regarding my plugin configuration.

Also, thanks for diagnosing the problem with the @FeignClient annotation. I'll see if the workaround of using that annotation drops the need for the runtime hints class whenever I have time.

And regarding the issues with the newer versions of spring boot and cloud, that is a separate bug, so it deserves its own issue. Or is that issue already created?

Comment From: OlgaMaciaszek

And regarding the issues with the newer versions of spring boot and cloud, that is a separate bug, so it deserves its own issue. Or is that issue already created?

You can create one.

Once that MVP is finished I'll see if I can find the issue regarding my plugin configuration.

I'm not sure there's any issue. I thought it was the case cause after switching to Boot starter there were no issues, but actually that was due to the fact that the scenario to reproduce this required extending Feign interface classes.

Comment From: Rocker93

Hi, I think there is some additional problem. When I try to upgrade from Boot 3.0.5 and cloud 2022.0.2 to Boot 3.1.2 and cloud 2022.0.4, I get the following issue: Proxy class defined by interfaces [interface com.xyz.MyApi, interface org.springframework.aop.SpringProxy, interface org.springframework.aop.framework.Advised, interface org.springframework.core.Decoratin gProxy] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options. Even though I've tried to put RegisterReflectionForBinding annotation for this class on Configuration annotated class, main method and application class, none work. Do you have any insight on what could fix this issue?

Comment From: OlgaMaciaszek

Thanks @Rocker93 - will check that.

Comment From: Rocker93

Hello @OlgaMaciaszek is there some update on this issue please? We are still not able to update Spring Boot due to this issue.

Comment From: OlgaMaciaszek

Hello @Rocker93, sorry for the delay - I'm going to work on it once we've finalised the 2023 release this week.

Comment From: til-avalaszek

Hello @OlgaMaciaszek is there some update on this issue please? We are still not able to build native due to this issue.

Comment From: OlgaMaciaszek

Sorry for the delay on this; this gets pushed back all the time as issues with higher priority appear. Will look now.

Comment From: OlgaMaciaszek

To introduce some order in this issue, the issue around AOP proxies that has been showcased in the sample provided by @CC007 has been removed through manually registering proxy hints. Later on, there were also changes introduced within other issues and at this point, if the project has uses Spring Boot 3.2.4 and Spring Cloud 2023.0.1 and uses Spring Boot starter parent, there should be no need to use the manual proxy hints workaround.

@Rocker93 and @til-avalaszek if after upgrading to Spring Boot 3.2.4 and Spring Cloud 2023.0.1 and using Spring Boot starter parent, you still have issues related to AOP-specific proxy hints, please provide a minimal, complete, verifiable example that reproduces the issue, as a link to a GH repo with an executable app.

Within this discussion @CC007 has also reported two separate issues. The one related to HostEnvironmentPostProcessor has been fixed in Commons within https://github.com/spring-cloud/spring-cloud-commons/issues/1233. I have now created a separate GH issue for the one related to Feign CodecException: https://github.com/spring-cloud/spring-cloud-openfeign/issues/1021. It's possible that the issue is related to the class being generated, but I'll take a closer look at it and provide any updates on it in that separate issue.

Comment From: til-avalaszek

Hi @OlgaMaciaszek. I updated Spring Boot to 3.2.4, Spring Cloud to 2023.0.1 and uses Spring Boot starter parent, but not resolve the problem. Caused by: org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access the proxy class inheriting [MyApiRestClient, org.springframework.aop.SpringProxy, org.springframework.aop.framework.Advised, org.springframework.core.DecoratingProxy] without it being registered for runtime reflection. Add [MyApiRestClient, org.springframework.aop.SpringProxy, org.springframework.aop.framework.Advised, org.springframework.core.DecoratingProxy] to the dynamic-proxy metadata to solve this problem. Note: The order of interfaces used to create proxies matters. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#dynamic-proxy for help. at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forProxy(MissingReflectionRegistrationUtils.java:89) at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:176) at java.base@21.0.1/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47) at java.base@21.0.1/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1034) at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:121) at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.buildProxy(AbstractAutoProxyCreator.java:517) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:464) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:369) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:318) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1907) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:139)

Comment From: OlgaMaciaszek

Thanks for the update @til-avalaszek. In this case, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: dpozinen

I am also experiencing this issue. The culprit here is @Validated, I believe, since when I removed it, I was able to use the client.

While the difference between the test you linked in https://github.com/spring-cloud/spring-cloud-openfeign/issues/860#issuecomment-1525114506 and the client setup described in the issue is apparent, I was not able to reproduce it in the test repository by using the same interface extend + @Validated setup. Will have a look more in depth at a later date

Comment From: OlgaMaciaszek

Thanks, @dpozinen. After this change, the boxedhello-minimal-app setup from the sample works fine for me. If you're still facing the issue on the new snapshots, please provide a sample.

Comment From: dpozinen

I'm still getting the same reflectively access the proxy class inheriting as @til-avalaszek above, I've verified that the change you linked is present. I've tried both java 21 and 17

Comment From: OlgaMaciaszek

Thanks @dpozinen, as requested above, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: til-avalaszek

I found the problem. It's happen when I use @Cacheable inside FeignClient interface. I removed and resolve the problem. Thanks.

Comment From: CC007

I will also check to see if it resolved the issue on my side. I'll keep you posted.

Comment From: CC007

It seems to work on the minimal-upgraded-sample branch, but on the master branch I do get an exception when I try to call the endpoint:

feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [nl.cqit.function.poc.java.helloworld.api.model.Person] and content type [application/json]
        at org.springframework.cloud.openfeign.support.SpringEncoder.encodeWithMessageConverter(SpringEncoder.java:170) ~[na:na]
        at org.springframework.cloud.openfeign.support.SpringEncoder.encode(SpringEncoder.java:117) ~[na:na]
        at feign.RequestTemplateFactoryResolver$BuildEncodedTemplateFromArgs.resolve(RequestTemplateFactoryResolver.java:273) ~[na:na]
        at feign.RequestTemplateFactoryResolver$BuildTemplateByResolvingArgs.create(RequestTemplateFactoryResolver.java:106) ~[boxedhello-minimal-app.exe:na]
        at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:65) ~[na:na]
        at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:99) ~[na:na]
        at jdk.proxy4/jdk.proxy4.$Proxy44.sayHello(Unknown Source) ~[na:na]
        at java.base@21.0.3/java.lang.reflect.Method.invoke(Method.java:580) ~[boxedhello-minimal-app.exe:na]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354) ~[na:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:174) ~[na:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223) ~[na:na]
        at jdk.proxy4/jdk.proxy4.$Proxy45.sayHello(Unknown Source) ~[na:na]
        at nl.cqit.function.poc.java.boxedhello.impl.BoxedHelloImpl.sayHello(BoxedHelloImpl.java:17) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.reflect.Method.invoke(Method.java:580) ~[boxedhello-minimal-app.exe:na]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354) ~[na:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768) ~[na:na]
        at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:174) ~[na:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768) ~[na:na]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720) ~[na:na]
        at nl.cqit.function.poc.java.boxedhello.controller.BoxedHelloController$$SpringCGLIB$$0.sayHello(<generated>) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.reflect.Method.invoke(Method.java:580) ~[boxedhello-minimal-app.exe:na]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:926) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:831) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) ~[boxedhello-minimal-app.exe:6.1.6]
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) ~[boxedhello-minimal-app.exe:6.0]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[boxedhello-minimal-app.exe:6.1.6]
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[boxedhello-minimal-app.exe:6.0]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:206) ~[na:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[na:na]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[boxedhello-minimal-app.exe:10.1.20]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[na:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[na:na]
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[na:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[na:na]
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[na:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[na:na]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[na:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[na:na]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[na:na]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[na:na]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[boxedhello-minimal-app.exe:10.1.20]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[na:na]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[boxedhello-minimal-app.exe:10.1.20]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[na:na]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) ~[na:na]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[na:na]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[boxedhello-minimal-app.exe:10.1.20]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[na:na]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) ~[na:na]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[boxedhello-minimal-app.exe:10.1.20]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[na:na]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[na:na]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[na:na]
        at java.base@21.0.3/java.lang.Thread.runWith(Thread.java:1596) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.Thread.run(Thread.java:1583) ~[boxedhello-minimal-app.exe:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896) ~[boxedhello-minimal-app.exe:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872) ~[boxedhello-minimal-app.exe:na]

Using the master branch of boxedhello-minimal-app (while helloworld-app is also running of course)

I might be missing something small and stupid, but I don't see the reason for this error.

Comment From: OlgaMaciaszek

@CC007 I have requested the minimal sample, because the master had too much things unrelated to the project set up. Please see if you can reproduce it with something more minimal. If not, I'll take a second look at it later on.

Comment From: OlgaMaciaszek

@til-avalaszek @Cacheable is not properly supported with SC OF clients at this point (https://github.com/spring-cloud/spring-cloud-openfeign/issues?q=is%3Aissue+is%3Aopen+cacheable). I suggest avoiding it till the issues listed are resolved.

Comment From: CC007

Hmm... I created a new branch named minimal-with-openapi, but that one seems to also work fine, even though it's not that different from the master branch.

I'll research a little bit more why there's a difference.

Comment From: OlgaMaciaszek

ok, @CC007, please get back to us once you've got more details or a minimal reproducer.

Comment From: CC007

I narrowed it down to whether the helloworld and boxedhello controller are in the same application or separate applications.

See minimal-with-openapi vs minimal-separate-apps, where minimal-with-openapi does work and minimal-separate-apps gives the exception when natively compiled.

Simply moving over the HelloWorldController, HelloWorldControllerAdvice and HelloWorldImpl class to the boxedhello app module and changing the port to 8080 instead of 8090 (or by making the HelloWorldService's feign client use port 8090), it suddenly works, without any explanation why it didn't beforehand.

Comment From: OlgaMaciaszek

Thanks, @CC007 - will take a look.

Comment From: OlgaMaciaszek

@CC007 Have submitted a change that should fix the issue.

Comment From: CC007

Ah, from what I gather from the commit, the issue was that the abstract methods were defined on (one of) the super interface(s). I'll take a look to see if this fixes my issue (and might even remove the need for the type hint that I already added).

Comment From: CC007

Woo!

HTTP/1.1 200 
Content-Type: application/json
Content-Length: 77
Date: Mon, 13 May 2024 21:16:14 GMT

+-----------------------+
| Hello, Separate Apps! |
+-----------------------+

Thank you very much for your help, @OlgaMaciaszek ! There was a lot of effort on your part to get it working.

It does still rely on HelloWorldServiceRuntimeHints though. Without it I get this error on startup:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'boxedHelloController': Unsatisfied dependency expressed through field 'helloWorldService': Error creating bean with nam
e 'nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService': Post-processing of FactoryBean's singleton object failed
2024-05-13T23:20:57.659+02:00  WARN 11292 --- [           main] o.s.c.support.GenericApplicationContext  : Exception thrown from ApplicationListener handling ContextClosedEvent

org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'applicationTaskExecutor': Singleton b
ean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:265) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:222) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[na:na]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:457) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1130) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1093) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:113) ~[boxedhello-minimal-app.exe:4.1.2]
        at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:211) ~[na:na]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:587) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:559) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1202) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1195) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1186) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:637) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[boxedhello-minimal-app.exe:3.2.5]   
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[boxedhello-minimal-app.exe:3.2.5]
        at nl.cqit.function.poc.java.Main.main(Main.java:12) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]

2024-05-13T23:20:57.661+02:00  INFO 11292 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]   
2024-05-13T23:20:57.662+02:00 ERROR 11292 --- [           main] o.s.boot.SpringApplication               : Application run failed      

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'boxedHelloController': Unsatisfied dep
endency expressed through field 'helloWorldService': Error creating bean with name 'nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService': Post-processing of FactoryBean's singleton object failed
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:194) ~[na:na]
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveAndSet(AutowiredFieldValueResolver.java:167) ~[na:na]
        at nl.cqit.function.poc.java.boxedhello.controller.BoxedHelloController__Autowiring.apply(BoxedHelloController__Autowiring.java:17) ~[na:na]
        at org.springframework.beans.factory.support.InstanceSupplier$1.get(InstanceSupplier.java:83) ~[na:na]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:949) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1217) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:962) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[boxedhello-minimal-app.exe:3.2.5]   
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[boxedhello-minimal-app.exe:3.2.5]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[boxedhello-minimal-app.exe:3.2.5]
        at nl.cqit.function.poc.java.Main.main(Main.java:12) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService': Post-processing of FactoryBean's singleton object failed
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1850) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1276) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:259) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1696) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1653) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1397) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.aot.AutowiredFieldValueResolver.resolveValue(AutowiredFieldValueResolver.java:188) ~[na:na]
        ... 23 common frames omitted
Caused by: org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access the proxy class inherit
ing [nl.cqit.function.poc.java.boxedhello.services.helloworld.HelloWorldService, org.springframework.aop.SpringProxy, org.springframewo
rk.aop.framework.Advised, org.springframework.core.DecoratingProxy] without it being registered for runtime reflection. Add [nl.cqit.fu
nction.poc.java.boxedhello.services.helloworld.HelloWorldService, org.springframework.aop.SpringProxy, org.springframework.aop.framewor
k.Advised, org.springframework.core.DecoratingProxy] to the dynamic-proxy metadata to solve this problem. Note: The order of interfaces used to create proxies matters. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#dynamic-proxy for help.    
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forProxy(MissingReflectionRegistrationUtils.java:89) ~[na:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.proxy.DynamicProxySupport.getProxyClass(DynamicProxySupport.java:176) ~[na:na]
        at java.base@21.0.3/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:47) ~[boxedhello-minimal-app.exe:na]
        at java.base@21.0.3/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1034) ~[boxedhello-minimal-app.exe:na]
        at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:124) ~[na:na]
        at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[na:na]
        at org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:127) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1907) ~[boxedhello-minimal-app.exe:6.1.6]
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:139) ~[boxedhello-minimal-app.exe:6.1.6]
        ... 33 common frames omitted

For now that's fine though, unless you feel like you want to fix that too.

Comment From: OlgaMaciaszek

Thanks @CC007, will take a look at it today.

Comment From: OlgaMaciaszek

@CC007 This seems to be related to having both the OF proxy and advised proxies used together. This is a specific scenario that has not been reported by others, so I'd say you should just use the hints registrar.

Comment From: dpozinen

I have verified it works for me as well with the hints. Thank you for your efforts