Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand iBATIS Spring Struts2 Integration

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you how to understand iBATIS Spring Struts2 integration, the content is very detailed, interested friends can use for reference, hope to be helpful to you.

A new Spring + iBATIS integration approach is added today, which makes it possible to inject SqlMapClientTemplate through Spring. The specific modes are as follows:

/ * * UserDAOImpl3.java * / package net.chinaideal.samples.ibatis.dao; import org.springframework.orm.ibatis.SqlMapClientTemplate; import net.chinaideal.samples.ibatis.model.User / * SpringiBatis-UserDAOImpl3.java *-* @ version 2007-1-23 * @ author Panglei (bj02267) *-- -* Note: * Integration can inject SqlMapClientTemplate of Spring's iBatis into * / public class UserDAOImpl3 implements UserDAO {private static final long serialVersionUID =-6615310540042830594L separately. / / iBatis SqlMapClientTemplate protected SqlMapClientTemplate sqlMapClientTemplate; / * (non-Javadoc) * @ see net.chinaideal.samples.ibatis.dao.UserDAO#getUserByUsername (java.lang.String) * / public User getUserByUsername (String username) {return (User) sqlMapClientTemplate.queryForObject ("getUserbyUsername", username);} public SqlMapClientTemplate getSqlMapClientTemplate () {return sqlMapClientTemplate } public void setSqlMapClientTemplate (SqlMapClientTemplate sqlMapClientTemplate) {this.sqlMapClientTemplate = sqlMapClientTemplate;}}

ApplicationContext.xml file:

Share To

Development

© 2024 shulou.com SLNews company. All rights reserved.

12
Report