版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Mybatis、Springmvc 练习CRM 系统北京市昌平区建材城西路龙办公楼一层:1 数据库数据库使用 mysql 数据库。1、创建 crm 数据库2、将参考资料中的 sql导入到数据库中2 工程搭建工程使用 Springmvc、spring、mybatis 框架整合完成。2.1SqlMapConfig.xml2.2applicationContext-dao.xml北京市昌平区建材城西路龙办公楼一层:<beansxmlns=""xmlns:xsi=""xmlns:mvc="schema/mvc"xmlns:context
2、=""xmlns:aop=""xmlns:tx="chema/tx"xmlns:task=""xmlns:dubbo="/schema/dubbo"xsi:schemaLocation="<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEconfigurationPUBLIC"-//DTD Config 3.0/EN" ""&g
3、t;<configuration></configuration>北京市昌平区建材城西路龙办公楼一层:"><!- 配置properties 文件 perties -><context:property-placeholderlocation="classpath:perties"/><!- 配置 数据源 -><beanid="dataSource"class="com.alibaba.druid.pool.DruidDataSour
4、ce"><!- 驱动 -><propertyname="driverClassName"value="$jdbc.driver"/><!- url -><propertyname="url"value="$jdbc.url"/><!- 用户名 -><propertyname="username"value="$jdbc.username"/><!-><propertyna
5、me="password"value="$jdbc.password"/></bean><!- 配置 Mybatis 的工厂 -><beanclass="org.mybatis.spring.SqlSessionFactoryBean"><!- 数据源 -><propertyname="dataSource"ref="dataSource"/><!- 配置Mybatis 的配置文件所在位置 -><property
6、name="configLocation"value="classpath:SqlMapConfig.xml"/><!- 配置pojo 别名 -><propertyname="typeAliasesPackage"value="cn.itcast.core.bean"></property></bean><!- 配置 1:原始Dao 开发 接口实现类 Mapper.xml 三个 2:接口开发 接口 不写实现类 Mapper.xml 二个(UserDao、P
7、roductDao、BrandDao。) 3:接口开发、并支持扫描 cn.itcast.core.dao(UserDao。) 写在此包下即可被扫描到 -><beanclass="org.mybatis.spring.mapper.MapperScannerConfigurer"><propertyname="basePackage"value="cn.itcast.core.dao"/></bean></beans>Jperties2.3applicationCont
8、ext-service.xml2.4applicationContext-trans.xml北京市昌平区建材城西路龙办公楼一层:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns=""xmlns:context=""xmlns:p="/schema/p"<beansxmlns=""xmlns:xsi=""xmlns:mvc="schema/mvc"xmlns:
9、context=""xmlns:aop=""xmlns:tx=""xmlns:task=""xmlns:dubbo=""xsi:schemaLocation=""><!- 配置 扫描Service -><context:component-scanbase-package="cn.itcast.core.service"/></beans>jdbc.driver=com.mysql.jdbc.Driver jdbc
10、.url=jdbc:mysql:/localhost:3306/crm?characterEncoding=utf-8 jdbc.username=rootjdbc.password=root2.5 Springmvc.xml北京市昌平区建材城西路龙办公楼一层:<beansxmlns=""xmlns:xsi=""xmlns:mvc="schema/mvc"xmlns:aop=""xmlns:tx="chema/tx"xmlns:xsi=""xsi:schemaLocat
11、ion=""><!- 事务管理器 -><beanid="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><!- 数据源 -><propertyname="dataSource"ref="dataSource"/></bean><!- 通知 -><tx:adviceid=&quo
12、t;txAdvice"transaction-manager="transactionManager"><tx:attributes><!-行为 -><tx:methodname="save*"propagation="REQUIRED"/><tx:methodname="insert*"propagation="REQUIRED"/><tx:methodname="add*"propagation=&qu
13、ot;REQUIRED"/><tx:methodname="create*"propagation="REQUIRED"/><tx:methodname="delete*"propagation="REQUIRED"/><tx:methodname="update*"propagation="REQUIRED"/><tx:methodname="find*"propagation="SUP
14、PORTS"read-only="true"/><tx:methodname="select*"propagation="SUPPORTS"read-only="true"/><tx:methodname="get*"propagation="SUPPORTS"read-only="true"/></tx:attributes></tx:advice><!- 切面 -><ao
15、p:config><aop:advisoradvice-ref="txAdvice"pointcut="execution(* cn.itcast.core.service.*.*(.)"/></aop:config></beans>2.6 Web.xml北京市昌平区建材城西路龙办公楼一层:<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="2.5"xmlns=""
16、;xmlns:xsi=""xsi:schemaLocation="">xmlns:context=""xmlns:aop=""xmlns:tx=""xmlns:task=""xmlns:dubbo=""xsi:schemaLocation=""><!- 加载属性文件 -><context:property-placeholderlocation="classpath:per
17、ties"/><!- 配置扫描 器 -><context:component-scanbase-package="cn.itcast.core.web.controller"/><!- 配置处理器器 适配器 -><mvc:annotation-driven/><!- 配置视图解释器 jsp -><beanid="jspViewResolver"class="org.springframework.web.servlet.view.InternalResourceV
18、iewResolver"><propertyname="prefix"value="/WEB-INF/jsp/"/><propertyname="suffix"value=".jsp"/></bean></beans>北京市昌平区建材城西路龙办公楼一层:<welcome-file-list><welcome-file>customer.action</welcome-file></welcome-file-li
19、st><!- 上下文的位置 -><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext-*.xml</param-value></context-param><!- Spring 的器 -><listener><listener-class>org.springframework.web.context.ContextLo
20、aderListener</listener-class></listener><!- POST 提交过滤器 UTF-8 -><filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name>
21、<param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encoding</filter-name><url-pattern>*.action</url-pattern></filter-mapping><!- 前端器 -><servlet><servlet-name>crm</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><!- 此处不配置 默认找 /WEB-INF/serv
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 麻疹、登革热、人感染禽流感诊疗方案试卷含答案
- 首席合规官(第二期)谈合规随堂测试卷(新能源造价合规专项)
- 支原体肺炎培训考核试题
- 护理质量控制质量控制体系
- 八年级语文下册 四季风光 第六课 春 第七课时 阅读理解与科普阅读教学设计 新教版(汉语)
- 地理东亚试题及答案
- 第17课 折扇工艺教学设计高中美术人教版2019选择性必修5 工艺-人教版2019
- 护理护理创新思维图
- 护理安全持续质量改进
- 护理学立法与护理职业发展动力
- 人力资源管理月度工作汇报
- DBJT15-82-2021 蒸压加气混凝土砌块自承重墙体技术规程
- (2025年标准)厂房协议委托租赁协议书
- 2024年长沙市口腔医院招聘真题
- 2025年云南省住院医师规范化培训结业理论考核(中医骨伤科)历年参考题库含答案详解(5卷)
- 地铁行车调度管理办法
- T/CECS 10210-2022给水用胶圈电熔双密封聚乙烯复合管材及管件
- 院前急救指南
- 骨干教师考试试题及答案
- 艺术品销售佣金协议范文
- 抖音工会合同协议
评论
0/150
提交评论