Skip to content

Instantly share code, notes, and snippets.

Brett C. bmchild

Block or report user

Report or block bmchild

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
package com.mypackage;
import java.lang.reflect.Method;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
public class ToStringUtil {
View log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="">
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<!-- Pattern to output the caller's file name and line number -->
<param name="ConversionPattern" value="%d{ISO8601} [%p] %m [(%M)%c]%n" />
View cluster-config.xml
<Cluster channelSendOptions="8" className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
<Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" domainReplication="true" notifyListenersOnReplication="true" />
<Channel className="">
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" />
bmchild / applicationContext.xml
Created Nov 16, 2011
maven-war-plugin using environments
View applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:xsi="" xmlns:aop=""
xmlns:tx="" xmlns:jee=""
bmchild / context.xml
Created Nov 17, 2011
Context.xml example with Connecter J PLugin
View context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- maxActive: Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to -1 for no limit.
<!-- maxIdle: Maximum number of idle dB connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on this
bmchild /
Created Jan 19, 2012
Custom regex lookup access Expression with Spring Security 3.1. The lookup, hasRegexRole, is available on the JSP or on the method.
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;
* @author bchild
bmchild /
Created Mar 1, 2012
An example of using @configuration for testing spring repositories
package com.bmchild.repository;
bmchild /
Created Mar 16, 2012
Join a Collection on any POJO with a Data Extractor
public class CallingMyCollectionsUtil {
private class Pojo {
private String field;
public String getField() {
bmchild /
Created Apr 9, 2012
Get Entity Class from spring JpaRepository
public static Class<?> getEntity(JpaRepository repo) {
Type clazzes = getGenericType(repo.getClass())[0];
Type[] jpaClass = getGenericType(getClass(clazzes));
return getClass( ((ParameterizedType)jpaClass[0]).getActualTypeArguments()[0]);
public static Type[] getGenericType(Class<?> target) {
if (target == null)
return new Type[0];
View org.springframework.ide.eclipse.core.springbuilder.launch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.springframework.ide.eclipse.core.springbuilder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
You can’t perform that action at this time.