SpringMVC+Spring 3+Hibernate 4フレームワーク構築(2)
2991 ワード
dbConfig.propertiesの構成、一部のデータベース接続情報は、構成のほんの一部しか使用されていません.
mvc-config.xmlは、アップロード機能も構成されています.
hibernate.cfg.xml、レベル2キャッシュが構成されています.
以上がすべてのプロファイルで、次は簡単ないくつかのクラスを作成して、基本的な機能をテストします.
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>
以上がすべてのプロファイルで、次は簡単ないくつかのクラスを作成して、基本的な機能をテストします.