Java Reference
In-Depth Information
@Repository("messageDao")
public class
MessageDaoImpl
extends
BaseDaoImpl<Message,Integer>
implements
MessageDao
@Repository("userDao")
public class
UserDaoImpl
extends
BaseDaoImpl<User,Integer>
implements
UserDao
{
Finally, we must configure Stripes to use its Spring interceptor
5
by
adding
to
the
list
of
extension
net.sourceforge.stripes.integration.spring
packages:
<init-param>
<param-name>
Extension.Packages
</param-name>
<param-value>
stripesbook.ext,
org.stripesstuff.stripersist,
net.sourceforge.stripes.integration.spring
</param-value>
</init-param>
We're now ready to use our Spring-managed DAOs.
Injecting the DAOs in the Action Beans
Remember that we previously had direct references to the implementa-
tions of the DAOs in
BaseActionBean
. We can now get Stripes to inject
the dependencies by retrieving them from the components loaded by
Spring. We need only to add the
@SpringBean
annotation:
public abstract class
BaseActionBean
implements
ActionBean {
@SpringBean
protected
AttachmentDao attachmentDao;
@SpringBean
protected
ContactDao contactDao;
@SpringBean
protected
FolderDao folderDao;
@SpringBean
protected
MessageDao messageDao;
@SpringBean
protected
UserDao userDao;
}
An empty
@SpringBean
annotation uses a naming convention. Stripes
looks for the Spring-managed component with the same name as the
5.
Don't worry about what an interceptor is for now. We'll discuss that topic in Sec-
Search WWH ::
Custom Search