This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletContext; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRequest; | |
import javax.servlet.ServletResponse; | |
import org.springframework.context.ApplicationContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order to match a @Qualifier reference like this (in a Spring-managed bean): | |
public class MyManagedBean { | |
@Autowired @Qualifier("bean_a") private MyBean myBean; | |
} | |
using the Grails Spring DSL, you do this: | |
myBean(MyBean) { bean -> | |
bean.beanDefinition.addQualifier(new org.springframework.beans.factory.support.AutowireCandidateQualifier( org.springframework.beans.factory.annotation.Qualifier, 'bean_a')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__git_repo () { | |
local g="$(__gitdir)" | |
local repo_dir="" | |
if [ -n "$g" ]; then | |
if [ ! ".git" == "$g" ]; then | |
git_dir=`dirname $g` | |
repo_dir=`basename $git_dir` | |
printf " $repo_dir" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An example of using Spring and Hibernate together to automatically create a HSQLDB in-memory database for testing hibernate mappings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Same as the earlier gist, but with JPA wrapping hibernate. Note that the choice of wether to create the tables or not is in the spring-config file, NOT the persistence.xml file like a lot of other examples out there. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PUBLIC is the default name of a HSQL database | |
truncate schema PUBLIC and commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.twasink.email; | |
import java.io.IOException; | |
import javax.activation.DataSource; | |
import javax.mail.MessagingException; | |
import javax.mail.internet.MimeMessage; | |
import javax.mail.util.ByteArrayDataSource; | |
import org.junit.Test; | |
import org.springframework.mail.SimpleMailMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmp $ mkdir nomasters | |
tmp $ cd nomasters/ | |
nomasters $ git init --bare | |
Initialized empty Git repository in /Users/robertdw/tmp/nomasters/ | |
nomasters [BARE:master]$ git log master | |
fatal: ambiguous argument 'master': unknown revision or path not in the working tree. | |
Use '--' to separate paths from revisions | |
nomasters [master]$ git remote add -t a_branch origin https://github.com/twasink/jbehave-spike | |
nomasters [master]$ git fetch | |
remote: Counting objects: 313, done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.hamcrest.Matchers.equalTo; | |
import static org.hamcrest.Matchers.is; | |
import static org.hamcrest.Matchers.not; | |
import static org.junit.Assert.assertThat; | |
import org.apache.commons.lang.math.NumberUtils; | |
import org.junit.Test; | |
public class NumberFunkyTest { | |
@Test public void testingSomeOddParsingBehaviourFoundEarlier() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('App.controller.SpikeController', { | |
extend: 'Ext.app.Controller', | |
refs: [ | |
{ ref: 'foobar', selector: '#foobar' }, | |
{ ref: 'bazbux', selector: '#bazbux' }, | |
{ ref: 'spikeView', selector: 'spike_view' } | |
], | |
init: function() { |
OlderNewer