------ Solution ------------------------------------ --------
<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- 配置Spring数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/ohshit_db?useUnicode=true&characterEncoding=UTF-8" />
<property name="user" value="root" />
<property name="password" value="test" />
<!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
<property name="initialPoolSize" value="1" />
<!--连接池中保留的最小连接数。 -->
<property name="minPoolSize" value="1" />
<!--连接池中保留的最大连接数。Default: 15 -->
<property name="maxPoolSize" value="15" />
<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="60" />
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="3" />
<!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
<property name="idleConnectionTestPeriod" value="60" />
</bean>
<!-- 集成Hibernate -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>org/ohshit/common/test/entitys/OhShitBugEntity.hbm.xml</value>
</list>
</property>
<property name="mappingDirectoryLocations">
<value>classpath:org/ohshit/common/entitys</value>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
</value>
</property>
</bean>
<!-- Spring 负责事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!--使用基于注解方式配置事务 -->
<tx:annotation-driven transaction-manager="txManager" />
<!-- 扫描 -->
<context:component-scan base-package="org.ohshit"></context:component-scan>
<!-- 打开注解处理器 -->
<context:annotation-config />
<!-- AOP -->
<aop:aspectj-autoproxy proxy-target-class="false"/>
<aop:aspectj-autoproxy/>
<!-- 定时任务 -->
<!-- 配置定时任务的执行器 -->
<bean id="servletContext" class="org.springframework.web.context.support.ServletContextFactoryBean" ></bean>
<bean id="updateAcclicationTask" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>org.ohshit.common.timer.OhShitApplicationUpdateTimer</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="initService">
<ref bean="InitService"/>
</entry>
<entry key="servletContext">
<ref bean="servletContext"/>
</entry>
</map>
</property>
<!--
<property name="applicationContextJobDataKey" value="applicationContext"/>
-->
</bean>
<!--触发器 -->
<bean id="updateAcclicationTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="updateAcclicationTask" />
<property name="startDelay">
<value>300000</value>
</property>
<property name="repeatInterval">
<value>5000000</value>
</property>
</bean>
<!--触发器 -->
<!--
<bean id="cronReportTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="reprotJob" />
<property name="cronExpression">
<value>0 0 6 * * ?</value>
</property>
</bean>
-->
<!-- 启动定时 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list><ref bean="updateAcclicationTrigger"/></list>
</property>
</bean>
<!-- WebService -->
<bean id="OhShitWebServiceImpl" class="org.ohshit.common.xfire.webserviceimpl.OhShitWebServiceImpl" />
<bean id="getDbWS" class="org.codehaus.xfire.spring.ServiceBean">
<property name="serviceBean" ref="OhShitWebServiceImpl" />
<property name="serviceClass" value="org.ohshit.common.xfire.webservice.OhShitWebService" />
<property name="inHandlers">
<list>
<ref bean="addressingHandler" />
</list>
</property>
</bean>
<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler" />
</beans>
------ For reference only ------------------------ ---------------
still own with it. MyEclipse code really put people into bondage .
------ For reference only -------------------------------------- -
good, you little project or compare yourself with exercise
------ For reference only --------------------- ------------------
ibatis hibernate in the spring where it is almost the same , LZ, look to the Internet , many examples are ,
----- - For reference only ---------------------------------------
agree to a floor view , they are worthy of better !

------ For reference only ---------------------------------------
they are worthy , since the framework can be understood run profiles, two good looking to post-test error causes
------ For reference only -------------------------- -------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 默认的视图主题 -->
<constant name="struts.action.excludePattern" value="/services/*,/services/OhShitWebService*" />
<constant name="struts.multipart.maxSize" value="208909129"/>
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.i18n.encoding" value="UTF-8" />
<constant name="struts.url.includeParams" value="none" />
<!-- 明确指出将由Spring负责创建Action实例 -->
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="true"/>
<package name="default" extends="struts-default">
<default-action-ref name="notFound" />
<action name="notFound">
<result>/WEB-INF/PROJECT-HOME/common/Error404.jsp</result>
</action>
</package>
<package name="ohshit-pakage" extends="struts-default" abstract="true">
<interceptors>
<interceptor name="OhShitPowerInterceptor" class="OhShitPowerInterceptor"/>
<interceptor name="OhShitCookieLoginInterceptor" class="OhShitCookieLoginInterceptor"/>
<interceptor-stack name="OhShitPowerInterceptor_stack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="OhShitPowerInterceptor"/>
</interceptor-stack>
<interceptor-stack name="OhShitCookieLoginInterceptor_stack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="OhShitCookieLoginInterceptor"/>
</interceptor-stack>
</interceptors>
<!--
<default-interceptor-ref name="OhShitPowerInterceptor"/>
-->
<global-results>
<result name="error">/WEB-INF/PROJECT-HOME/common/CommonError.jsp</result>
<result name="login">/WEB-INF/PROJECT-HOME/Login.jsp</result>
<!-- 用于对cookie登录的控制 -->
<result name="success_Main_cookie" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
<result name="success_authenticator_cookie">/WEB-INF/PROJECT-HOME/Authenticator.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception">/WEB-INF/PROJECT-HOME/common/CommonError.jsp</exception-mapping>
</global-exception-mappings>
</package>
<package name="index" namespace="/" extends="ohshit-pakage">
<default-interceptor-ref name="OhShitCookieLoginInterceptor_stack"/>
<action name="NavigateAction" method="navigate" class="NavigateAction">
<param name="serachtype">MAX_NEW</param>
<result name="index" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
<result name="register" type="dispatcher">/WEB-INF/PROJECT-HOME/Register.jsp</result>
<result name="login" type="dispatcher">/WEB-INF/PROJECT-HOME/Login.jsp</result>
<result name="edituserinfo" type="dispatcher">/WEB-INF/PROJECT-HOME/userinfo/EditUserInfo.jsp</result>
<result name="chgpass" type="dispatcher">/WEB-INF/PROJECT-HOME/userinfo/ChgPassWord.jsp</result>
<result name="logout" type="chain">
<param name="method">logout</param>
<param name="actionName">LoginAction</param>
<param name="namespace">/login</param>
</result>
<result name="face" type="dispatcher">/WEB-INF/PROJECT-HOME/userinfo/MyJsp.jsp</result>
<result name="About" type="dispatcher">/WEB-INF/PROJECT-HOME/system/AboutOhShit.jsp</result>
<result name="Help" type="dispatcher">/WEB-INF/PROJECT-HOME/system/HelpOhShit.jsp</result>
<result name="Advert" type="dispatcher">/WEB-INF/PROJECT-HOME/system/AdvertOhShit.jsp</result>
<result name="Account" type="dispatcher">/WEB-INF/PROJECT-HOME/system/AccountOhShit.jsp</result>
<result name="inWall" type="dispatcher">/WEB-INF/PROJECT-HOME/MainInWall.jsp</result>
<result name="license" type="dispatcher">/WEB-INF/PROJECT-HOME/system/license.jsp</result>
<result name="bug" type="dispatcher">/WEB-INF/PROJECT-HOME/Test/SubmitBug.jsp</result>
</action>
</package>
<package name="login" namespace="/login" extends="ohshit-pakage">
<action name="LoginAction" class="LoginAction">
<result name="success_Login">/WEB-INF/PROJECT-HOME/Login.jsp</result>
<result name="success_authenticator">/WEB-INF/PROJECT-HOME/Authenticator.jsp</result>
<result name="input_Register">/WEB-INF/PROJECT-HOME/Register.jsp</result>
<result name="input_Login">/WEB-INF/PROJECT-HOME/Login.jsp</result>
<result name="success_Main" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
<result name="success_logout" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
</action>
</package>
<package name="issue" namespace="/issue" extends="ohshit-pakage">
<action name="IssueAction" class="IssueAction">
<result name="success">/WEB-INF/PROJECT-HOME/Main.jsp</result>
<result name="success_send" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
</action>
<action name="DiscussAction" class="DiscussAction">
<result name="success_view">/WEB-INF/PROJECT-HOME/View.jsp</result>
<result name="success_replay" type="chain">
<param name="method">view</param>
<param name="actionName">DiscussAction</param>
<param name="namespace">/issue</param>
</result>
<result name="success_queryreplay" >/WEB-INF/PROJECT-HOME/View.jsp</result>
</action>
</package>
<package name="userinfo" namespace="/userinfo" extends="ohshit-pakage">
<default-interceptor-ref name="OhShitPowerInterceptor_stack"/>
<action name="UserInfoAction" class="UserInfoAction">
<result name="success" type="dispatcher">/WEB-INF/PROJECT-HOME/userinfo/MyJsp.jsp</result>
<result name="success_saveUserInfo" >/WEB-INF/PROJECT-HOME/userinfo/EditUserInfo.jsp</result>
<result name="success_viewUserInfo" >/WEB-INF/PROJECT-HOME/userinfo/ViewUserInfo.jsp</result>
<result name="success_viewReply" >/WEB-INF/PROJECT-HOME/userinfo/ViewReply.jsp</result>
<result name="success_viewFuns" >/WEB-INF/PROJECT-HOME/userinfo/ViewFunsInfo.jsp</result>
<result name="success_viewfave" >/WEB-INF/PROJECT-HOME/userinfo/ViewFave.jsp</result>
<result name="input_chgpass" type="dispatcher">/WEB-INF/PROJECT-HOME/userinfo/ChgPassWord.jsp</result>
<result name="success_chgpass" type="dispatcher">/WEB-INF/PROJECT-HOME/Login.jsp</result>
</action>
<action name="FllowAction" class="FllowAction">
<result type="stream">
<param name="contentType">text/html</param>
<param name="inputName">inputStream</param>
</result>
</action>
<action name="PhotoAction" class="PhotoAction">
<result type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">photoinputStream</param>
</result>
</action>
</package>
<package name="test" namespace="/test" extends="ohshit-pakage">
<action name="BugAction" class="BugAction">
<!--
<result name="success">/WEB-INF/PROJECT-HOME/Main.jsp</result>
-->
<result name="success" type="chain">
<param name="method">queryIssue</param>
<param name="actionName">IssueAction</param>
<param name="namespace">/issue</param>
</result>
</action>
</package>
<package name="Security" namespace="/Security" extends="struts-default">
<action name="SecurityCodeImageAction" class="SecurityCodeImageAction">
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">imageStream</param>
<param name="bufferSize">2048</param>
</result>
</action>
</package>
</struts>
------ For reference only ------------------- --------------------
retrieve information
desired profile
1, struts.xml
2, applicationContent.xml
3, Mybatis.xml (ibatis3 above )
4, web.xml
------ For reference only ----------------------------- ----------
SSI is best to have a relatively large number of demo project functions reference ah
------ For reference only ----------- ----------------------------
you have this project source package do ? Thank you send me a copy 30657581@qq.com trouble ! !
------ For reference only -------------------------------------- -
you have this project source package do ? Thank you send me a copy 30657581@qq.com trouble ! !
are sorry this is what I do for others an entire station code I can not give you
------ For reference only ------ ---------------------------------
you have this project source package do ? Thank you send me a copy 30657581@qq.com trouble ! !
are sorry this is what I do for others an entire station code I can not give you
Give ssi project done with annotations demo do ? Grateful !
没有评论:
发表评论