Blog Archives

Testing with SpringJUnit4ClassRunner

Testing with SpringJUnit4ClassRunner is breeze. First add annotations: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { “/appContext.xml” }) public class SimpleDaoTest{ … } Place resources on classpath: src/main/test/resources Add dependencies: <dependency>     <groupId>org.springframework</groupId>     <artifactId>spring-test</artifactId>     <version>${springframework.version}</version>     <scope>test</scope> </dependency> Annotate test class: @Autowired

Tagged with: , ,
Posted in JUnit, Spring, Testing

Load testing with Jmeter

Found these 2 useful articles that explain how to Load test a Spring WebFlow application with Jmeter: Article #1: – June 2007, still useful but unfortunately the images are no longer hosted 😦 Article #2: – 2010 Note:

Tagged with:
Posted in Performance, Spring, Spring WebFlow, Testing

Spring Security

The Spring Security Namespace configuration is made up of the following two namespaces: Web Application Security namespace (<http>) – defines protected urls Authentication Services namespace – defines beans that will be used to authenticate users Web Application Security (<http>) After

Tagged with: ,
Posted in Spring, Spring Security

Spring MVC: Specify MIME headers

There’s seems to be 2 options. 1) Use ResponseEntity<String> as return type: String xml = … HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.setContentType(MediaType.APPLICATION_XML); return new ResponseEntity<String>(xml, responseHeaders, HttpStatus.OK) 2) Use ‘produces’ attribute of @RequestMapping @RequestMapping(value=”/some/page”, produces=”application/xml”) Test both methods, and they

Posted in Spring, Spring MVC

Spring Insight

Just learned about Spring Insight, a technology that allows us to see the runtime performance of our applications. Demo by SpringSource YouTube Channel: At 3:17 he shows how to enable insight by using the insight tab, however my 3.0.0 version

Posted in Spring

Setting up SSL

SSL serves two purposes : Encryption – data is encrypted with SSL before being sent using HTTP Authentication – the Certificate Authority guarantees the certificate holder is who they say they are First Step is to create a Self Sign

Posted in Java, Maven, Spring Security


Today we look at @InitBinder annotation. This can be used to set and invoke a custom Validator (Note: Don’t try and mix this with @Valid / JSR303 – the Bean Validation annotations). In essence it allows us to replace this

Posted in Spring, Spring MVC