Şöyle yaparız
import jakarta.enterprise.inject.spi.Extension;public class StartupBeanExtension implements Extension { private final Set<Bean<?>> startupBeans = new LinkedHashSet<>(); <X> void processBean(@Observes ProcessBean<X> event) { if (event.getAnnotated().isAnnotationPresent(Startup.class) && event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)) { this.startupBeans.add(event.getBean()); } } void afterDeploymentValidation(@Observes AfterDeploymentValidation event, BeanManager manager) { for (Bean<?> bean : startupBeans) { manager.getReference(bean, bean.getBeanClass(), manager.createCreationalContext(bean)) .toString(); } } }
Hiç yorum yok:
Yorum Gönder