Skip to content

Instantly share code, notes, and snippets.

View StefanHeimberg's full-sized avatar

Stefan Heimberg StefanHeimberg

View GitHub Profile
// https://rmannibucau.wordpress.com/2015/03/10/cdi-and-startup/
@ApplicationScoped
public class ProvisioningDataForApplicationLifecycle {
private final Map<String, User> users = new HashMap<>(); // + getter
public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
users.put("cdi", new User("cdi", "1.1"));
users.put("deltaspike", new User("deltaspike", "1.3"));
}
@StefanHeimberg
StefanHeimberg / CDIUtil.java
Last active September 2, 2018 21:39
java ee 6 lookup utilities
package com.github.stefanheimberg.example.support;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
public final class CDIUtil {
public static <T> T lookupByName(final String name) {
final BeanManager bm = getBeanManager();
@StefanHeimberg
StefanHeimberg / happy_git_on_osx.md
Created November 11, 2015 07:32 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@StefanHeimberg
StefanHeimberg / entity-rules.xml
Last active October 13, 2015 14:59
JQAssistant Rules für Entities
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">
<!-- http://neo4j.com/developer/cypher/ -->
<constraint id="entity-rules:FieldAccess">
<requiresConcept refId="jpa2:Entity" />
<description>All JPA Entities without Field Access</description>
<cypher><![CDATA[
MATCH
(e:Jpa:Entity)-[:DECLARES]->(m:Method),
@StefanHeimberg
StefanHeimberg / persistence.xml
Last active September 1, 2015 20:36 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->