@@ -87,6 +87,10 @@ public class BeanInfo implements InjectionTargetInfo {
8787
8888 private final List <MethodInfo > aroundInvokes ;
8989
90+ private final List <MethodInfo > postConstructCallbacks ;
91+
92+ private final List <MethodInfo > preDestroyCallbacks ;
93+
9094 private final InterceptionProxyInfo interceptionProxy ;
9195
9296 // Following fields are only used by synthetic beans
@@ -173,6 +177,15 @@ public class BeanInfo implements InjectionTargetInfo {
173177 this .targetPackageName = targetPackageName ;
174178 this .startupPriority = startupPriority ;
175179 this .aroundInvokes = isInterceptor () || isDecorator () ? List .of () : Beans .getAroundInvokes (implClazz , beanDeployment );
180+ if (isClassBean () && !isInterceptor ()) {
181+ this .postConstructCallbacks = Beans .getCallbacks (target .asClass (), DotNames .POST_CONSTRUCT ,
182+ beanDeployment .getBeanArchiveIndex ());
183+ this .preDestroyCallbacks = Beans .getCallbacks (target .asClass (), DotNames .PRE_DESTROY ,
184+ beanDeployment .getBeanArchiveIndex ());
185+ } else {
186+ this .postConstructCallbacks = List .of ();
187+ this .preDestroyCallbacks = List .of ();
188+ }
176189 }
177190
178191 @ Override
@@ -457,8 +470,7 @@ public boolean hasDestroyLogic() {
457470 }
458471 // test class bean with @PreDestroy interceptor or callback
459472 return isClassBean () && (!getLifecycleInterceptors (InterceptionType .PRE_DESTROY ).isEmpty ()
460- || !Beans .getCallbacks (target .get ().asClass (), DotNames .PRE_DESTROY , beanDeployment .getBeanArchiveIndex ())
461- .isEmpty ());
473+ || !preDestroyCallbacks .isEmpty ());
462474 }
463475
464476 public boolean isForceApplicationClass () {
@@ -533,6 +545,22 @@ boolean hasBoundDecoratorMatching(Predicate<DotName> predicate) {
533545 return false ;
534546 }
535547
548+ /**
549+ *
550+ * @return the list of {@code @PostConstruct} callback methods declared in the hierarchy of a bean class
551+ */
552+ List <MethodInfo > getPostConstructCallbacks () {
553+ return postConstructCallbacks ;
554+ }
555+
556+ /**
557+ *
558+ * @return the list of {@code @PreDestroy} callback methods declared in the hierarchy of a bean class
559+ */
560+ List <MethodInfo > getPreDestroyCallbacks () {
561+ return preDestroyCallbacks ;
562+ }
563+
536564 /**
537565 *
538566 * @return the list of around invoke interceptor methods declared in the hierarchy of a bean class
0 commit comments