use of javax.annotation.PostConstruct in project deltaspike by apache.
the class Initializer method create.
@PostConstruct
public void create() {
// Create user john
User john = new User("john");
john.setEmail("john@acme.com");
john.setFirstName("John");
john.setLastName("User");
IdentityManager identityManager = this.partitionManager.createIdentityManager();
identityManager.add(john);
identityManager.updateCredential(john, new Password("123456"));
}
use of javax.annotation.PostConstruct in project oxTrust by GluuFederation.
the class BuildVersionService method initalize.
@PostConstruct
public void initalize() {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = factory.newDocumentBuilder();
Document doc = dBuilder.parse((getClass().getResourceAsStream("/META-INF/beans.xml")));
doc.getDocumentElement().normalize();
log.info("Root element :" + doc.getDocumentElement().getNodeName());
NodeList nList = doc.getElementsByTagName("bean");
if (doc.hasChildNodes()) {
readBuildDetails(nList);
}
} catch (Exception ex) {
log.error("Failed to obtain build version", ex);
}
}
use of javax.annotation.PostConstruct in project CzechIdMng by bcvsolutions.
the class AuditableListener method register.
/**
* Register listener to hibernate
*/
@PostConstruct
public void register() {
LOG.debug("Registering auditor listener [{}]", AuditableListener.class.getSimpleName());
SessionFactoryImpl sessionFactoryImpl = (SessionFactoryImpl) entityManagerFactory.getSessionFactory();
EventListenerRegistry registry = sessionFactoryImpl.getServiceRegistry().getService(EventListenerRegistry.class);
registry.getEventListenerGroup(EventType.PRE_INSERT).appendListener(this);
registry.getEventListenerGroup(EventType.PRE_UPDATE).appendListener(this);
LOG.debug("Registered auditor listener [{}]", AuditableListener.class.getSimpleName());
}
use of javax.annotation.PostConstruct in project cas by apereo.
the class CasSamlSPInCommonConfiguration method init.
@PostConstruct
public void init() {
final SamlRegisteredService service = SamlSPUtils.newSamlServiceProviderService(casProperties.getSamlSp().getInCommon(), samlRegisteredServiceCachingMetadataResolver);
if (service != null) {
SamlSPUtils.saveService(service, servicesManager);
LOGGER.info("Launching background thread to load the InCommon metadata. Depending on bandwidth, this might take a while...");
new Thread(() -> {
LOGGER.debug("Loading InCommon metadata at [{}]...", service.getMetadataLocation());
samlRegisteredServiceCachingMetadataResolver.resolve(service);
}).start();
}
}
use of javax.annotation.PostConstruct in project cxf by apache.
the class ResourceInjector method invokePostConstruct.
public void invokePostConstruct() {
boolean accessible = false;
for (Method method : getPostConstructMethods()) {
PostConstruct pc = method.getAnnotation(PostConstruct.class);
if (pc != null) {
try {
ReflectionUtil.setAccessible(method);
method.invoke(target);
} catch (IllegalAccessException e) {
LOG.log(Level.WARNING, "INJECTION_COMPLETE_NOT_VISIBLE", method);
} catch (InvocationTargetException e) {
LOG.log(Level.WARNING, "INJECTION_COMPLETE_THREW_EXCEPTION", e);
} finally {
ReflectionUtil.setAccessible(method, accessible);
}
}
}
}
Aggregations