Last Updates | Login      

Auto-wiring your components

The classic example is a DAO that depends on a java.sql.Connection. All you have to do in your ApplicationManager is:

Now everything that has an attribute of type Connection.class with the name "conn" will receive a connection. The connection will come from the action input with the same name (key) "conn".

The injection will happen through a setter (setConn) or straight into the private or public instance variable (Connection conn).

You can also use the source method to define a different key value that will be used to get the connection implementation from the action input.

Instead of doing a input.getValue("conn") to get the connection, the DIFilter will do a input.getValue("connection").

Inversion of Control

The Talker component and some implementations:

Configure the components in the ApplicationMananger. (You must say what implementation you want to use!)

InjectionFilter will inject in the action through setter or straight into the instance variable (public or private):

Note that the InjectionFilter is injecting the components into the action, but you can also do this if you want to:

Bean persistence with MentaBeans

Having the following database schema:


In the ApplicationManager:

Loading beans:

Inserting beans:

Adding beans to a relationship: (OneToOne)

Adding beans to a relationshiop: (OneToMany)

Removing a bean from a relationshiop: (OneToMany)

Updating a bean:

Deleting a bean:

Loading lists: