26 Eylül 2022 Pazartesi

Jakarta EE Extension Arayüzü

Örnek
Şö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

Bean Validation @GroupSequence Anotasyonu

Örnek Elimizde şöyle bir kod olsun public class SampleRequest {   @NotNull   LocalDate startDate;   @NotNull   LocalDate endDate;   @AssertT...