-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
I have an extension that produces a synthetic bean (in the actual project I have some handling with qualifiers and so on).
This synthetic bean has to be proxied to apply e.g. @Retry
which otherwise, would be ignored.
There is a weird behavior which I found as that bean extends another class.
It seems that when I call my been over the method which is annotated with @Retry
I do access another super class than when I access the superclass over a non-annotated method.,leading to a unexpected behaviour/return value.
My build step method
@BuildStep
@Record(RUNTIME_INIT)
public void registerClients(BuildProducer<SyntheticBeanBuildItem> syntheticBeans, ClientRecorder recorder) {
log.info("Registering Azure FileShare Client");
syntheticBeans.produce(SyntheticBeanBuildItem.configure(AdvancedClient.class)
.scope(ApplicationScoped.class)
.setRuntimeInit()
.injectInterceptionProxy()
.createWith(recorder.createAdvancedClientWith("test"))
.done());
}
}
my creator method
public Function<SyntheticCreationalContext<AdvancedClient>, AdvancedClient> createAdvancedClientWith(String name) {
return context -> {
log.info("Creating advanced client for {}", name);
return (AdvancedClient) context.getInterceptionProxy().create(new AdvancedClient(name));
};
}
My bean
@Slf4j
public class AdvancedClient extends BaseClient {
AdvancedClient() {
super(null);
log.info("Initializing AdvancedClient with noArgs constructor");
}
public AdvancedClient(String name) {
super(name);
log.info("Initializing AdvancedClient with name {}", name);
}
@Retry
public String getProxiedName() {
return getName();
}
}
My superclass
@Getter
@RequiredArgsConstructor
public class BaseClient {
private final String name;
}
Expected behavior
When calling getName()
or getProxiedName()
I expected both times the name given on the creator method.✅
Actual behavior
When calling getProxiedName()
I do get the name given within the creator method.✅
When calling getName()
I get null
❌
Is this intended behaviour and I did just understand something wrong?
How to Reproduce?
- Clone
https://github.com/HerrDerb/quarkus-extension-playground.git
- Checkout branch
syntetic-bean-issue
- Run tests in deployment module
Quarkus 3.21.4