Spring 3.2.1+proxool +mysql空白项目搭建


lib目录jar包列表

applicationContent.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans default-lazy-init="true"
	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:tx="http://www.springframework.org/schema/tx"
	xmlns:task="http://www.springframework.org/schema/task" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
            http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd             
			http://www.springframework.org/schema/mvc 
			http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
            ">
	<!-- 自动扫描 -->
	<context:component-scan base-package="org.kingschan.ac"></context:component-scan>
	<!-- 用注解来实现事务管理 -->
	<tx:annotation-driven transaction-manager="transactionManager" />
	<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
		<property name="driver">
			<value>${jdbc.driverClassName}</value>
		</property>
		<property name="driverUrl">
			<value>${jdbc.url}</value>
		</property>
		<property name="delegateProperties">
      		<value>user=${jdbc.username},password=${jdbc.password}</value>
    	</property>
		<property name="user">
			<value>${jdbc.username}</value>
		</property>
		<property name="password">
			<value>${jdbc.password}</value>
		</property>
		<property name="alias">
			<value>${jdbc.alias}</value>
		</property>
		<property name="prototypeCount">
			<value>${jdbc.prototypeCount}</value>
		</property>
		<property name="maximumConnectionCount">
			<value>${jdbc.maximumConnectionCount}</value>
		</property>
		<property name="minimumConnectionCount">
			<value>${jdbc.minimumConnectionCount}</value>
		</property>
		<property name="trace">
			<value>${jdbc.trace}</value>
		</property>
		<property name="verbose">
			<value>${jdbc.verbose}</value>
		</property>
		<property name="maximumActiveTime">
			<value>${jdbc.maximumActiveTime}</value>
		</property>
	</bean>
	<bean id="jdbctemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource"> 
            <ref bean="dataSource"/> 
        </property> 
	</bean>
	<!-- 配置JDBC事务管理器 --> 
    <bean id="transactionManager" 
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 
        <property name="dataSource"> 
            <ref bean="dataSource"/> 
        </property> 
    </bean> 

	<!-- spring的属性加载器,加载properties文件中的属性 -->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
		<list>
			<value>classpath:db.properties</value>
		</list>			
		</property>
		<property name="fileEncoding" value="utf-8" />
	</bean>
	<!-- 启动Spring MVC的注解功能--> 
	<mvc:annotation-driven/>
	
	<!-- 视图解释类 begin-->
	<!-- 
		 exposeRequestAttributes,exposeSessionAttributes 是请求和会话属性都被复制到模板的属性集中,
		 可以使用FreeMarker的表达式语言来访问并显示。 
		exposeSpringMacroHelpers使用这些宏
	 -->
	 <bean id="viewResolver"
		class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
		<property name="cache" value="true" /> 
		<property name="prefix" value=""/>
		<property name="suffix" value=".html" />
		<property name="contentType" value="text/html;charset=UTF-8"></property>
		<property name="requestContextAttribute" value="request" />
		<property name="exposeSpringMacroHelpers" value="true" />
		<property name="exposeRequestAttributes" value="true" />
		<property name="exposeSessionAttributes" value="true" /> 
		<property name="allowSessionOverride" value="true" /> 
		
	</bean> 
	<bean id="freemarkerConfig"
		class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
		<property name="templateLoaderPath" value="/WEB-INF/page/flt" />
		<property name="freemarkerSettings">
			<props>
				<prop key="template_update_delay">0</prop>
				<prop key="default_encoding">UTF-8</prop>
				<prop key="number_format">0.##########</prop>
				<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
				<prop key="classic_compatible">true</prop>
				<prop key="template_exception_handler">ignore</prop>
			</props>
		</property>
	</bean> 
	<!-- 视图解释类 end-->
</beans>  

WEB.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
	xmlns="http://java.sun.com/xml/ns/javaee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <servlet>
		<servlet-name>dispatcherServlet</servlet-name>
		<servlet-class>
			org.springframework.web.servlet.DispatcherServlet
		</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>
				classpath*:dispatch-servlet.xml
			</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>dispatcherServlet</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	
 <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
 <login-config>
  <auth-method>BASIC</auth-method>
 </login-config>
<!-- spring -->
	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>
	
	<!--spring 监听器-->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener> 
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
	</context-param>
	<!-- Filter 定义  -->
	<!-- Character Encoding filter -->
	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>
			org.springframework.web.filter.CharacterEncodingFilter
		</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	
	
</web-app>
db.properties:

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://UGEY2B73QSJNNX6:3306/sms
#jdbc.url=jdbc:mysql://localhost:3306/sms
jdbc.username=root
jdbc.password=xxxxxx
#jdbc.password=foshancgt
jdbc.alias=pdb
jdbc.houseKeepingSleepTime=10000
jdbc.prototypeCount=5
jdbc.maximumConnectionCount=10000
jdbc.minimumConnectionCount=2
jdbc.maximumActiveTime=54000
jdbc.trace=false
jdbc.verbose=false
jdbc.houseKeepingTestSql=select 1
jdbc.simultaneousBuildThrottle=20

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值