Skip to content

Instantly share code, notes, and snippets.

arey / applicationContext-mockito.xml
Created August 26, 2013 13:55
Injecting Mockito mocks into a Spring bean Avoid NoSuchBeanDefinitionException
View applicationContext-mockito.xml
<bean id="myService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.mockito.Mockito" factory-method="mock">
value="com.javaetmoi.IService" />
<property name="proxyInterfaces">
arey /
Created March 30, 2018 16:34
Java Logback configuration replacing classic logback.xml use
package com.javaetmoi.logback;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.joran.action.JMXConfiguratorAction;
import ch.qos.logback.classic.jul.LevelChangePropagator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
arey / JarFileClassPathLocationScanner
Created January 21, 2014 11:04
Flyway JarFileRecursiveClassPathLocationScanner for jar files opening all war and jar recursively.
View JarFileClassPathLocationScanner
package com.googlecode.flyway.core.util.scanner.classpath;
import java.util.Enumeration;
import java.util.Set;
arey / musicbrainz_fulltext
Created November 12, 2013 19:11
Full text search example on the MusicBrainz Elasticsearch index created by the batch provided in the repository.
View musicbrainz_fulltext
curl -XPOST '' -d '
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
"fuzzy_like_this": {
"fields": [
arey / musicbrainz_autocomplete
Last active December 28, 2015 03:39
Search query that could be used for completion suggestions on the MusicBrainz Elasticsearch index created by the batch provided in the repository.
View musicbrainz_autocomplete
curl -XPOST '' -d '
"fields": [
"query": {
"query_string": {
arey / u2_archtung_baby.json
Created November 10, 2013 12:17
JSON document indexed into Elasticsearch (ref.
View u2_archtung_baby.json
"id": "744c7a1b-ac79-35c4-bd92-7e2c6a24c8d8",
"name": "Achtung Baby",
"year": 1991,
"tags": [
"pop rock",
"album rock",
arey / select_musicbrainz_u2_album
Created October 2, 2013 06:54
SQL query retrieving all U2 album from the MusicBrainz database.
View select_musicbrainz_u2_album
release_group.gid AS albumid,
release_group.type AS albumPrimaryTypeId, as albumPrimaryTypeName, AS albumName, AS artistName,
artist.gid AS artistGid,
artist.type as artisTypeId, as artistTypeName,
artist.begin_date_year artistBeginDateYear,
arey /
Created September 6, 2013 06:14
Test case mixing both the DbSetup and the Spring frameworks
package com.javametmoi.test.dbsetup;
import static com.ninja_squad.dbsetup.Operations.insertInto;
import static com.ninja_squad.dbsetup.Operations.sequenceOf;
import static org.junit.Assert.assertEquals;
import java.sql.SQLException;
import javax.sql.DataSource;
arey /
Created September 5, 2013 17:05
A DbSetup destination which wraps a DataSource and gets its connection from a JDBC DataSource, adding awareness of Spring-managed transactions.
package com.javametmoi.test.dbsetup;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
arey / pom-ear-jboss.xml
Created January 4, 2013 11:12
Configuration du plugin maven-ear-plugin générant e fichier jboss-app.xml avec isolation du classloader de l'EAR.
View pom-ear-jboss.xml
<!-- Generation du classPath dans le Manifest de l'EAR, paramétrage du classloader -->
<!-- et recopie centralisée des JARs des WARs dans le répertoire lib -->