Direct Approach
This approach uses static lookups to retrieve needed spring beans.

Pros:
  • Simple
Cons:
  • Objects are tightly coupled to the WebApplication subclass
Interesting classes:

Below is the code from DirectModel which is a detachable contact model. Notice the static lookup used to retrieve the spring bean needed to reload the Contact from the database.
DirectModel.java
public class DirectModel extends ContactDetachableModel {

	public DirectModel(Contact contact) {
		super(contact);
	}

	protected ContactDao getContactDao() {
		return ((ExampleApplication) Application.get()).getContactDao();
	}

}