Skip to content

Instantly share code, notes, and snippets.

View Qkyrie's full-sized avatar

QDS Qkyrie

  • Layer 0
View GitHub Profile
@Qkyrie
Qkyrie / persistence.xml
Created July 17, 2013 07:36
Hibernate autocreate
<property name="hibernate.hbm2ddl.auto" value="create" />
@Qkyrie
Qkyrie / persistence.xml
Created July 17, 2013 07:36
hibernate import
<property name="hibernate.hbm2ddl.import_files" value="/import.sql"/>
@Qkyrie
Qkyrie / ConfigValue.java
Created July 17, 2013 07:38
ConfigValue annotation for automatically injecting configuration strings
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Qkyrie
Qkyrie / ConfigValueProducer.java
Created July 17, 2013 07:42
ConfigValue Producer for automatically injecting configuration strings
@Produces
@ConfigValue("")
@Dependent
public String configValueProducer(InjectionPoint ip) {
// We know this annotation WILL be present as WELD won't call us otherwise, so no null checking is required.
ConfigValue configValue = ip.getAnnotated().getAnnotation(ConfigValue.class);
// This could potentially return a null, so the function is annotated @Dependent to avoid a WELD error.
return props.getProperty(configValue.value());
}
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 07:50
maven profiles for filtering property-files with filters
...
<profile>
<id>myId</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<filter.properties>filter-values-myId.properties</filter.properties>
</properties>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 07:59
jax-ws maven plugin, to automatically import a wsdl to java
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>WSImport of WSDL</id>
<goals>
<goal>wsimport</goal>
</goals>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:00
Add sources for maven to see (build-helper-maven-plugin)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:02
copy library to folder with maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
@Qkyrie
Qkyrie / pom.xml
Created July 17, 2013 08:03
sign jar with maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign</id>
<phase>prepare-package</phase>
<goals>
<goal>sign</goal>
@Qkyrie
Qkyrie / WebserviceDebugLogging.java
Created July 17, 2013 08:04
set the system properties to display the debug logging for webservice calls
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");