SpringMVC+Spring3+Hibernate4框架搭建(2)

dbConfig.properties的配置,一些数据库连接信息,只用了配置的一小部分:

driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://127.0.0.1:3306/ssh
user=root
password=
initialPoolSize=5
minPoolSize=5
maxPoolSize=10
maxStatements=10

mvc-config.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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan base-package="simples.web" use-default-filters="false">
    	<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
    </context:component-scan>
    <mvc:annotation-driven/>
    
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass">
			<value>org.springframework.web.servlet.view.JstlView</value>
		</property>
		<property name="prefix">
			<value>/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>
	
     <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
         <property name="maxUploadSize" value="800000000"/>
     </bean> 

</beans>

hibernate.cfg.xml,配置了2级缓存:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
 <session-factory name="sessionFactory">
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="show_sql">true</property>
  <property name="hbm2ddl.auto">update</property>

  <property name="cache.use_second_level_cache">true</property>
<property name="cache.region.factory_class ">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
 </session-factory>
</hibernate-configuration>

以上就是全部配置文件,下一篇将编写简单的几个类,来测试基本的功能。

你可能感兴趣的:(SpringMVC+Spring3+Hibernate4框架搭建(2))