Monthly Archives: April 2008

Spring component scan and StoredProcedure

Let’s say you wrap stored procedures with Spring’s StoredProcedure class like this:

That @Repository annotation, like @Component and @Service, allows you to tell Spring to scan the classpath and instantiate them without you having to write a bean element in your Spring XML file. You can even inject dependencies like the DataSource with the […]

Posted in Spring Framework | Tagged | Leave a comment

Spring and Transactions

I’ve been taking a legacy codebase, putting testing in place and refactoring. For DB access I retrofitted the persistence classes to be injected via Spring with a DataSource instead of looking them up via JNDI. IN my Spring context I defined a PlatformTransactionManager.

Then I refer to it in the the test case class. […]

Posted in DB, Spring Framework, Testing | Tagged , | Leave a comment

JUnit4, Selenium and Spring test context

In a previous post I wrote about using JUnit4 with Selenium. So how about injecting your JUnit run listener via Spring? My first attempt modified my runner to be a subclass of SpringJUnit4ClassRunner Then I created the usual XML spring config file but named it after my test class name. So for FooTests I created […]

Posted in Selenium, Spring Framework, Testing | Tagged , , | 3 Responses

JUnit4 and Selenium

The Selenium website seems to be biased towards TestNG. That’s fine but I’m using JUnit4. One nice feature of the selenium testcase class is to produce a screendump for failures. But it’s a JUnit 3 class; it seems they have not noticed that JUnit4 exists. So how to get a screendump with a JUnit4 test […]

Posted in Selenium, Testing | Tagged , | 3 Responses