0

The interface set within the ServiceLocatorFactoryBean is not found when trying to autowire it in another class. This works fine in a non-native application but when built as a native application the following error gets thrown when trying to start the application.

Field myInterface in com.test.TestService required a bean of type 'com.test.MyInterface' that could not be found.

The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.test.MyInterface' in your configuration.

I have the Bean defined as such.

@Bean
public ServiceLocatorFactoryBean serviceLocatorFactoryBean() {
    final ServiceLocatorFactoryBean factory = new ServiceLocatorFactoryBean();
    factory.setServiceLocatorInterface(MyInterface.class);

    return factory;
}

I tried registering the AOT hint for the proxied interface but the same error was thrown.

hints.proxies()
     .registerJdkProxy(MyInterface.class, SpringProxy.class, Advised.class, DecoratingProxy.class);

Is there a reflection hint that needs to be provided for the ServiceLocatorFactoryBean?

0 Answers0