2017-06-01-SSM框架-jar以及xml配置文件
来源:互联网 发布:java查询信息管理系统 编辑:程序博客网 时间:2024/06/15 09:09
创建ssm项目导入jar包分类
jar包分类
- aop
- connectionpool-c3p0
- jdbc-mysql
- jstl
- log
- mybatis
- spring-springmvc
aop
aopalliance.jar
aspectjrt.jar
aspectjweaver.jar
connctionpool-c3p0
c3p0-0.9.2.1.jar
c3p0-oracle-thin-extras-0.9.2.1.jar
mchange-commons-java-0.2.3.4.jar
jdbc-mysql
mysql-connector-java-5.1.40-bin.jar
jstl
jstl.jar
standard.jar
log
commons-logging-1.2.jar
log4j-1.2.17.jar
log4j-api-2.3.jar
log4j-core-2.3.jar
mybatis
mybatis-3.4.1.jar
mybatis-spring-1.3.0.jar
spring-springmvc
spring-aop-4.3.5.RELEASE.jar
spring-aspects-4.3.5.RELEASE.jar
spring-beans-4.3.5.RELEASE.jar
spring-context-4.3.5.RELEASE.jar
spring-context-support-4.3.5.RELEASE.jar
spring-core-4.3.5.RELEASE.jar
spring-expression-4.3.5.RELEASE.jar
spring-instrument-4.3.5.RELEASE.jar
[spring-instrument-tomcat- 4.3.5.RELEASE.jar]
spring-jdbc-4.3.5.RELEASE.jar
spring-jms-4.3.5.RELEASE.jar
spring-messaging-4.3.5.RELEASE.jar
spring-orm-4.3.5.RELEASE.jar
spring-oxm-4.3.5.RELEASE.jar
spring-test-4.3.5.RELEASE.jar
spring-tx-4.3.5.RELEASE.jar
spring-web-4.3.5.RELEASE.jar
spring-webmvc-4.3.5.RELEASE.jar
spring-webmvc-portlet-4.3.5.RELEASE.jar
spring-websocket-4.3.5.RELEASE.jar
jar包下载
点击进入>百度网盘分享链接—链接:http://pan.baidu.com/s/1pLTslFd 密码:k7a9
xml配置文件
web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>yimei</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:config/spring-*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping></web-app>
spring-aop.xml
<?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> <!-- 包扫描:com.share.controller包, com.share.aspect下所有类都自动产生对象 --> <context:component-scan base-package="com.share.*.*"> <!-- 配置访问com.share.controller包下的切点时,都要经过(切面)动态代理 --> <context:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect"/> </context:component-scan> <!-- 启动@AspectJ支持:配置SpringAOP支持动态代理及AOP的注解方式 --> <aop:aspectj-autoproxy/> </beans>
spring-mvc.xml
<?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: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.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"> <!-- base-package="com.share.controller"为设置需要进行注解扫描的包--> <context:component-scan base-package="com.share.*.*" /> <!--第一步: 打开Spring注解 --> <mvc:annotation-driven /> <!-- 开启Spring的注解 --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> <!-- 这里的class属性是固定写法 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!--JstlView表示JSP模板页面需要使用JSTL标签库,classpath中必须包含jstl的相关jar包 --> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <!-- 查找视图页面的前缀和后缀(前缀[逻辑视图名]后缀),比如传进来的逻辑 视图名为hello,则该jsp视图页面应该存放在“WEB-INF/jsp/hello.jsp” --> <property name="prefix" value="/WEB-INF/page/" /> <property name="suffix" value=".jsp" /> </bean></beans>
spring-mybatis.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" 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-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 配置基于C3P0的数据源 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <value>com.mysql.jdbc.Driver</value> </property> <property name="jdbcUrl"> <value>jdbc:mysql://123.58.4.25:3306/yimei?useUnicode=true&characterEncoding=UTF-8</value> </property> <property name="user"> <value>web</value> </property> <property name="password"> <value>123456.com</value> </property> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement"> <value>3</value> </property> <!--初始化时获取三个连接。Default: 3 --> <property name="initialPoolSize"> <value>3</value> </property> <property name="minPoolSize"> <value>5</value> </property> <property name="maxPoolSize"> <value>100</value> </property> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime"> <value>60</value> </property> <!--每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod"> <value>0</value> </property> <!-- JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements 属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。 如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0 --> <property name="maxStatements"> <value>100</value> </property> <!-- 通过 多线程实现多个操作同时被执行。Default: 3 --> <property name="numHelperThreads"> <value>10</value> </property> </bean> <!-- 配置mybaits连接工厂类 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 指定mybatis配置文件路径 --> <property name="configLocation" value="classpath:config/SqlMapConfig.xml"></property> </bean> <!-- 构造方法形式注入工厂类至sqlSessionTemplate --> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg ref="sqlSessionFactory"></constructor-arg> </bean> <!-- 配置事务驱动 --> <bean id="TransactionManager" name="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <tx:annotation-driven transaction-manager="txManager" /> <!-- 扫描basePackage下所有以@MyBatisRepository标识的 接口 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!--扫描的包路径 --> <property name="basePackage" value="com.share.*.*" /> </bean></beans>
SqlMapConfig.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE configuration PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-config.dtd"><configuration> <mappers> <mapper resource=""/> </mappers></configuration>
dao层中的相关配置
MyBatisRepository.java
package com.share.dao;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)public @interface MyBatisRepository {}
LoginDao.java
package com.share.dao;import org.springframework.stereotype.Repository;import com.share.bean.User;@Repository@MyBatisRepositorypublic interface LoginDao { public User getUser(String username);}
LoginDao.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"><mapper namespace="com.share.dao.LoginDao"> <resultMap type="com.share.bean.User" id="user"> <result column="username" property="username"/> <result column="password" property="password"/> </resultMap> <select id="getUser" parameterType="java.lang.String" resultMap="user"> select username,password from t_user where username=#{username} </select></mapper>
- 2017-06-01-SSM框架-jar以及xml配置文件
- 【SSM-MyBatis框架】Mapper.xml配置文件(mybatis的核心)
- SSM框架,基于JavaConfig配置方式,不用xml配置文件
- ssm框架maven配置文件pom.xml配置信息
- SSM:spring+springmvc+mybatis框架中的XML配置文件功能
- Maven 管理SSM框架的pom.xml配置文件
- SSM框架整合方式(二):XML配置文件代码
- SSM框架整合方式(一):XML配置文件代码
- SSM配置文件-web.xml
- SSM框架的配置文件
- SSM框架配置文件整理
- ssM框架简单配置文件
- ssm框架配置文件
- SSM框架整合 配置文件
- SSM框架配置文件上传
- ssm框架中的配置文件
- SSM框架相关jar简介
- 整合ssm框架之配置文件
- /sys/class/gpio 文件接口操作IO端口(s3c2440)
- 浅谈es6+react
- 网站技术架构发展--[1.网站架构演化]
- JAVA编码学习--想
- oracle建立表空间和用户
- 2017-06-01-SSM框架-jar以及xml配置文件
- 求约束条件下极值的拉格朗日乘子法
- 最简单最通俗易懂之正则的贪婪模式和懒惰模式
- mysql 5.7.18 Can't change dir to引发的一系列问题(初始化data、改root密码)
- 自制小四轴:从入门到放弃——基于stm32的小四轴系列(二)
- 用思维导图分析Android工程架构
- IntelliJ IDEA 学习手册
- vSphere中配置嵌套虚拟化
- Only a type can be imported. javax.transaction.Synchronization