Spring is a great framework for dependency injection and it comes with a lot of support classes and utilities for all kind of things. Hibernate is a persistence service with a lot of useful features, that is relatively easy to use. Configuring both frameworks is not always easy. Configuring them together is sometimes hard and it is easy to make mistakes.
This blog addresses a problem in a configuration that is fairly common: use Spring for transaction management on top of a JTA provider and use Hibernate for persistence. Transaction demarcation is easy and declarative with Spring. The problem is that Hibernate sometimes needs to detect the current transaction and this needs to be configured. This leads to hard to detect bugs in applications that rely on auto flushing.
(more...)
Tags: auto flush, Hibernate, JTA, Spring
Filed under Hibernate, JTA, Spring | 4 Comments »
On our latest project, My colleague Tjeerd Kaastra and I, have been using Wicket.
Since our GUI was so complex, and we had to write 100s of unit tests (a lot of corner cases), we sat down with our testers to find out how we should approach this. Because Our testers use Fitnesse to test both functional acceptance as well as regression tests, they test a lot of the code as well. So we thought, why not integrate the two and that is what we did.
This blog describes how to test Wicket applications using Fitnesse. It is about stretching the limits of the Wicket test components to do so. We will try to explain this by using a small example project we have created to illustrate things. This example project has been inspired on the new user wizard example by Eelco Hillenius. We adapted this example so that it uses Spring, because most apps use a backend system.
Around 6 months back me and Vikas Hazrati gave a XTR on Adobe Flex to my colleagues in Xebia India.
We took some resources from Adobe Dev Net site and eventually found a cool article explaining how Flex Data Services works with Spring using Spring Remoting features and so on.
We were quite amazed with the UI capabilities of Flex with its server side integration. If you look at that article now, its start with a disclaimer saying "Effective with the release of Adobe LiveCycle ES, the Adobe Flex Data Services 2 server product has been rebranded as a Solution Component of LiveCycle ES."
(more...)
Filed under Architecture, Flex, Java, Requirements Management, Spring | No Comments »
The purpose of this post is to give a Maven based sample code of Spring with Stripes integration. The source code set is already in Eclipse project format, so you can use eclipse to view files content and structure.
This post will not explain about the techniques of integrating spring with stripes. The spring with stripes integration is very well explained at Stripes framework wiki page - Spring with Stripes. I kindly suggest you to read that documentation first before trying out the sample code given in this post. This post also assume that you are familiar with the basics of Maven, Eclipse, Stripes and Spring.
Few of the other "How to" samples (like Ajax addition, addition, echo, stripes layout reuse) that were documented in Stripes framework wiki page were also included in this sample code.
(more...)
AppFuse is an open source project and application that uses open source tools built on the Java platform to help you develop
web applications quickly and efficiently.
In a typical web application, it is common to have a login screen, registration screen, content storage in database, security and most importantly testing.
When building a Java web application, we might start adding one jar file after another to implement a particular user story.
For example, if i want to have ACEGI security for my web app, I might download ACEGI jar, map and configure it in web.xml and security.xml files.
What if, there exists a toolkit that already provides these common features to us. ?
(more...)
Filed under Agile, Architecture, Frameworks, Hibernate, Java, Spring | 2 Comments »
We’ve all being there, we’ve all had this on a project once or maybe even more times. The assignment is to build an application but there is no data for you to work with. There could be any number of reasons this could be the case - to name a few, the web-service that should be connected is not done in time, the database migration is postponed. Then someone has to create database scripts with test data, or implement a test web-services. This is all a waste of time.
But lucky for you now there is a solution.
(more...)
Filed under AOP, Frameworks, Java, Spring, Testing | 2 Comments »
Concept to auto-wire relationships among spring enabled beans has always been there. The idea with auto-wiring is to get away from the tedious task of specifying and more importantly maintaining explicit wiring. Originally it was supported to be done by name, by type, by constructors or auto-detect and then you had the option to auto-wire all or specific beans within a context. But now with Spring 2.5 the auto wiring concept has taken a whole new meaning and so is the debate if we really want to do auto-wiring.
Spring 2.5 has a new @Autowire annotation. @Autowire annotation let us do much fine grained auto-wiring then was possible before and also it make us much more explicit then was possible in pre Spring 2.5 times
(more...)
Filed under Java, Spring | 4 Comments »
Recently I wanted to add an aspect to some domain object, so that it was saved, the moment it changed state. However, after adding this aspect, the whole build of course failed, because a lot of the unit tests weren't expecting the calls which were now woven into the domain object.
(more...)
Filed under AOP, Java, Spring, Testing | 5 Comments »
Quartz is a Java Framework for scheduling. It allows applications to schedule tasks for execution in the future. Spring is a Java IoC container. It helps glue together the components that make up an application. This blog elaborates on where the two meet and how they can work together to make developing your application easier.
(more...)
Filed under Java, Spring | 1 Comment »
Recently I needed to write an integration test that covered a transaction over multiple SessionFactories and different datasources. I wanted it to be an outside-the-container-test and therefor I needed some ability to do transactions over multiple datasources without all the stuff a J2EE container would provide.
A good start for writing transactional tests can be found, as usual, in Spring. All you need to do is to extend the AbstractTransactionSpringContextTests class and the rest is a piece of cake. Now the question is how to wire this up for multiple datasources?
Filed under Hibernate, Java, Spring, Testing | 2 Comments »