Skip to content

Instantly share code, notes, and snippets.

View jonashackt's full-sized avatar
:octocat:
TDD & CI for IaC FTW!

Jonas Hecht jonashackt

:octocat:
TDD & CI for IaC FTW!
View GitHub Profile
@jonashackt
jonashackt / gist:d6c062b1263559d4da13
Created May 19, 2015 09:33
doing parameter validation in methods and constructors
Objects.requireNonNull(after);
@jonashackt
jonashackt / pom.xml
Created July 7, 2015 06:09
Maven dependency to local project
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
@jonashackt
jonashackt / settings.xml
Created July 7, 2015 08:34
Maven configure Download of Sources and Javadoc once and for all
<profiles>
<profile>
<id>downloadSources</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
@jonashackt
jonashackt / settings.xml
Created July 7, 2015 08:36
Maven configure another Repo
<mirrors>
<mirror>
<id>camel-snapshots</id>
<name>Apache Camel Snapshots</name>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<mirrorOf>camel-snapshots</mirrorOf>
</mirror>
<mirror>
<id>jitpack.io</id>
<name>Jitpack Releases</name>
@jonashackt
jonashackt / gist:a5605ce850dc3094432b
Created July 13, 2015 09:37
Decode and write Base64-encoded ISO_8859_1 String to Pdf-File
private static void decodeAndWriteBase64Pdf() throws Exception {
System.out.print("Enter base64EncodedPdfAsIsoString (e.g. from SOAP-Call):");
Scanner s = new Scanner(System.in);
String base64EncodedPdfAsIsoString = s.nextLine();
s.close();
@jonashackt
jonashackt / consoleSpringBootRemoteDebug
Created July 23, 2015 12:10
Running SpringBoot-Fatjar with remote-debugging
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar target/myproject-0.0.1-SNAPSHOT.jar
@jonashackt
jonashackt / ReadFile.java
Last active August 29, 2015 14:25
Loading Files SpringBoot-Fatjar with Java8 NIO.2
public static InputStream readFileInClasspath2InputStream(String folderWithEndingSlash, String fileName) throws BusinessException {
InputStream inputStream = null;
try {
Path filePath = buildPath(folderWithEndingSlash, fileName);
inputStream = Files.newInputStream(filePath);
} catch (Exception exception) {
throw new BusinessException(ERROR_MSG_START + exception.getMessage(), exception);
}
return inputStream;
}
@jonashackt
jonashackt / WebServiceConfiguration.java
Created August 13, 2015 13:00
Activate Logging of SOAP-Messages with Apache CXF directly on the SpringBus
@Bean(name=Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
SpringBus springBus = new SpringBus();
LoggingFeature logFeature = new LoggingFeature();
logFeature.setPrettyLogging(true);
logFeature.initialize(springBus);
springBus.getFeatures().add(logFeature);
return springBus;
}
@jonashackt
jonashackt / WebServiceConfiguration.java
Created August 13, 2015 13:01
Activate Logging of SOAP-Messages with Apache CXF seperately on exposed CXF-Endpoint
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), weatherService());
endpoint.publish(SERVICE_NAME_URL_PATH);
endpoint.setWsdlLocation("Weather1.0.wsdl");
LoggingFeature logFeature = new LoggingFeature();
logFeature.setPrettyLogging(true);
logFeature.initialize(springBus());
endpoint.getFeatures().add(logFeature);
return endpoint;
@jonashackt
jonashackt / WebServiceMessageLoggerConfiguration.java
Created August 13, 2015 13:13
Configure Logging of SOAP-Messages with Apache CXF with Spring Profiles
@Configuration
@Profile("logsoapmessages")
public class WebServiceMessageLoggerConfiguration {
@Autowired
private SpringBus springBus;
@Bean
public LoggingFeature loggingFeature() {
// Log SoapMessages to Logfile