瀏覽代碼

上传文件至 'resource'

1701010542 6 年之前
父節點
當前提交
a3afb8387b
共有 3 個文件被更改,包括 81 次插入0 次删除
  1. 48 0
      resource/applicationContext.xml
  2. 二進制
      resource/mysql-connector-java-5.1.6-bin.jar
  3. 33 0
      resource/springmvc-config.xml

+ 48 - 0
resource/applicationContext.xml

@@ -0,0 +1,48 @@
+<?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"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+        http://www.springframework.org/schema/context
+        http://www.springframework.org/schema/context/spring-context.xsd">
+        
+        <context:component-scan base-package="service"/><!-- 扫描service包 -->
+         <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+        	<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
+        	<property name="url" value="jdbc:mysql://localhost/employee?useUnicode=true&amp;characterEncoding=UTF-8"/>
+        	<property name="username" value="root"/>
+        	<property name="password" value="1388023"/>
+        </bean>
+        
+        <!-- 
+        <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+           <property name="dataSource" ref="dataSource"></property>
+           <property name="configLocation" value="classpath:mybatis-config.xml"></property> 
+        </bean>
+         -->
+         
+        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
+        	<property name="basePackage" value="dao"/>
+        </bean>
+        
+        
+        <bean id="sqlSessionFactory"  class="org.mybatis.spring.SqlSessionFactoryBean">
+        	<property name="dataSource" ref="dataSource"/>
+        	<property name="mapperLocations" value="classpath*:dao/*Mapper.xml"></property>
+            <property name="plugins">
+              <array>
+                <bean class="com.github.pagehelper.PageInterceptor">
+                  <property name="properties">
+                    <value>
+                     pageSizeZero=ture
+                     reasonable=true              
+                    </value>
+                  </property>
+                </bean>
+              </array>
+       </property>
+        </bean>
+        
+        
+        </beans>

二進制
resource/mysql-connector-java-5.1.6-bin.jar


+ 33 - 0
resource/springmvc-config.xml

@@ -0,0 +1,33 @@
+<?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.3.xsd
+       http://www.springframework.org/schema/context
+       http://www.springframework.org/schema/context/spring-context-4.3.xsd
+       http://www.springframework.org/schema/mvc
+       http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
+        
+        <context:component-scan base-package="controller"/>
+        
+        <bean id="jspViewResover" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        	<property name="prefix" value="/WEB-INF/jsp/"/>
+        	<property name="suffix" value=".jsp"/>
+        </bean>
+        
+     
+     <!-- 配置注解驱动 -->
+    <mvc:annotation-driven/>
+    <mvc:default-servlet-handler/>
+     <!-- 处理静态资源 -->
+        
+        
+     <bean id="multipartResolver"
+         class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
+         	<!-- 设置请求编码格式 -->
+         <property name="defaultEncoding" value="UTF-8"/>
+         </bean>
+        </beans>