Spring+SpringMVC+mybatis整合以及注解的使用(三)

时间:2023-06-30 16:31:02

1.包结构:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAG7CAIAAACpZCX8AAAgAElEQVR4nO2d/VfU1v7v+Wtc19W17j39ttV2PPV6jg+l/bZS9Vuf26K2U3mw51y1ihRBtEzRqoyCCohAeVRQUFunWkVO7bGgYltbaz3AqYK0wAxQymMG+H5zfwhkkuy9k8xDJnsnn9fKcpGQvRPkxZ4ks9/zieEBgE1izD4BAAgRcBdgFXAXYJVouHvqo7QoHAWwG5F0d6z/ybfFyXcKNt0p2HSvYvv2ZYsSFs5NWDg3YdFc4Yv0dXERPBxgcyLp7lefxP3ReXek58FIzwPfT1c/iJvf/nVu21dHExbObb+R2/7V0YSFcyN4OMDmBOFuY2NjdnY26btjfY++zpr72zcf/v6Da/iHjwZbMna8Pr/1uvvhtcMJC+f+63rOvxpywF0gguh1t6Gh4amnnpo1axZph28OLen5/uTgv2uGHp0denQ2ddXi6QsG+ZKzNQHbvM3tiJnG6ZnZ4PR4nDExMQ53G8/zvMc5s8f0BsDe6HJXEHf16tUq7l7NeIbr9UiXncv/0n4jt+0fR4RrhjaVawZBVGRTTGCjxwnKAnK03RXFXbNmjYq7PT9dH277cuBuqb+/fWLwwb+//MDjWvhN/tJv8pdeylpw88TSmyeWfv7Rgjufvt1SthFpLYypUjnlOnucYC6gQMNdqbjq7k6M+DpOrxt9dLqz9u2Jsd+77x7hui9w3Re57s+4ns+5ns+5nktcr2fgYVnD/gWEPoSxVpAU3AU00HA3Ozt7lgSXy0Xa09dc0P751g/X/u9fLiT/fv/8RH8T11HOdVRwnZVcZyXXWcU9qe7/4diXBxb3PfpW2bjN7fbMfDWtrOIywuMMXEB43KAxEKlnZJOjA63FcR3fZL7+v2KGH3zSVvZfU6PdXNsxrv0Y136caz/B/Tu/ryXbk/VX3y93sT0EbsSmDUUugQN3c4orY8CmRMbd3264n3wWP/ogvf6TWO7hnkdn1/V9V8s9c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gY3PSn92+iTda3I1cXk1RTYToriLKJp892+Z2onPHCUk4ortIARW1hBwu6kacAi87hm0Tb7S4G7G8mlpcR/FrlEwCl4fNBAgJZF76feV8ccWpybZjI2y4cBAp64Y/kH1TQ7S4G7G8WhDuBl69lfpIxzj5/T8uCUeQF+Mu+icC7oYOLe5GLq+mEjVDFZS+rGLSvrzsmpKUhENezqefMyDXDJjgkKq7pJ8FEm88z9PjbuTyatJNikEVM3wq74ukATKhC6dTNu5ii6XJDip/Wka6V9PlLiE2B4k3nufpcTdyeTU5kXzyZHbRHojNyaHF3cjl1eSw7S7E5tSgxd3I5dXksO0uxObUoMVdAAgWcBdgFXAXYBVwF2AVcBdgFXAXYJX/D2sUc0/NR9XKAAAAAElFTkSuQmCC" alt="" />

 2.spring配置:基本的DAO配置以及扫描Mapper(扫描出来的Mapper为首字母小写)

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <context:property-placeholder location="classpath:db.properties"/> <!-- 数据库连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="10" />
<property name="maxIdle" value="5" />
</bean> <!-- Mybatis的工厂 -->
<bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 核心配置文件的位置 -->
<property name="configLocation" value="classpath:sqlMapConfig.xml"/>
</bean> <!-- Mapper动态代理开发 扫描 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 基本包 -->
<property name="basePackage" value="cn.qlq.springmvc.mapper"/>
</bean> <!-- 注解事务 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean> <!-- 开启注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/> </beans>

3.mybatis配置(主要就一个定义别名)

 <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 设置别名 -->
<typeAliases>
<!-- 2. 指定扫描包,会把包内所有的类都设置别名,别名的名称就是类名,大小写不敏感 -->
<package name="cn.qlq.springmvc.pojo" />
</typeAliases> </configuration>

4.springMVC配置(主要就是配置扫描Service和Controller)

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <!-- 扫描@Controler @Service -->
<context:component-scan base-package="cn.qlq"/> <!-- 处理器映射器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/> -->
<!-- 处理器适配器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/> -->
<!-- 注解驱动 -->
<mvc:annotation-driven/> <!-- 视图解释器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean> </beans>

5.Service使用注解注入Mapper(主要就是自己添加service注释与内部注入mapper)

   5.1 接口(接口中不做任何声明)

 package cn.qlq.springmvc.service;
import java.util.List; import cn.qlq.springmvc.pojo.Items;
public interface ItemService {
public List<Items> findAllItems();
}

    5.2.Service实现类(自己添加service注释与内部注入mapper)

 package cn.qlq.springmvc.service;

 import java.util.List;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import cn.qlq.springmvc.mapper.ItemsMapper;
import cn.qlq.springmvc.pojo.Items; @Service
public class ItemsServiceImpl implements ItemService { @Autowired
private ItemsMapper itemsMapper;
@Override
public List<Items> findAllItems() { List<Items> selectByExampleWithBLOBs = itemsMapper.selectByExampleWithBLOBs(null);
return selectByExampleWithBLOBs;
} }

6. 控制层(声明自己是Controller层与自动注入Service)

package cn.qlq.springmvc.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView; import cn.qlq.springmvc.pojo.Items;
import cn.qlq.springmvc.service.ItemService; /**
* 商品管理
*
* @author lx
*
*/
@Controller
public class ItemController {
@Autowired
private ItemService itemService;
//入门程序 第一 包类 + 类包 + 方法名
@RequestMapping(value = "/item/itemlist.action")
public ModelAndView itemList(){
//从Mysql中查询
List<Items> list = itemService.findAllItems(); ModelAndView mav = new ModelAndView();
//数据
mav.addObject("itemList", list);
mav.setViewName("itemList");
return mav;
} }

总结:Service层注入时只用在实现类上声明service。注入时候注入接口名字。可以用自动装配@Autowired,也可以用

@Resource(name="baseDao")
private BaseDao baseDao;
这种格式注入对象,name就是扫描后的名字。