Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.github.jangalinski.deltaspike;
import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class PlaygroundApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(PlaygroundApplication.class);
@PostConstruct
public void init() {
LOGGER.info("postconstruct");
}
public static void main(String... args ) {
LOGGER.info("running");
CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
cdiContainer.boot();
cdiContainer.getContextControl().startContext(ApplicationScoped.class);
BeanProvider.getContextualReference(PlaygroundApplication.class, false);
cdiContainer.shutdown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment