Skip to content

Instantly share code, notes, and snippets.

@milenkovicm
Created May 31, 2012 12:04
Show Gist options
  • Save milenkovicm/2842980 to your computer and use it in GitHub Desktop.
Save milenkovicm/2842980 to your computer and use it in GitHub Desktop.
Cdi Extension quick start
package com.example
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CdiExtension implements Extension {
private static final Logger LOG = LoggerFactory.getLogger(CdiExtension.class);
void processObserverMethod(@Observes final ProcessObserverMethod<?, ?> processObserverMethod) {
LOG.debug("processObserverMethods() processObserverMethod={}", processObserverMethod);
}
void processBean(@Observes final ProcessBean<?> processBean) {
LOG.debug("processBean() processBean={}", processBean);
}
void processAnnotatedType(@Observes final ProcessAnnotatedType<?> processAnnotatedType) {
LOG.debug("processAnnotatedType() processAnnotatedType={}", processAnnotatedType);
}
void afterDeploymentValidation(@Observes final AfterDeploymentValidation afterDeploymentValidation, final BeanManager beanManager) {
LOG.debug("afterDeploymentValidation() afterDeploymentValidation={}", afterDeploymentValidation);
}
void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery beforeBeanDiscovery) {
LOG.debug("beforeBeanDiscovery() beforeBeanDiscovery={}", beforeBeanDiscovery);
}
void afterBeanDiscovery(@Observes final AfterBeanDiscovery afterBeanDiscovery) {
LOG.debug("afterBeanDiscovery() afterBeanDiscovery={}", afterBeanDiscovery);
}
void beforeShutdown(@Observes final BeforeShutdown beforeShutdown) {
LOG.debug("beforeShutdown() beforeShutdown={}", beforeShutdown);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment