首页 > 代码库 > ssh maven

ssh maven

  1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  2   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  3   <modelVersion>4.0.0</modelVersion>  4   <groupId>myssh</groupId>  5   <artifactId>ssh</artifactId>  6   <packaging>war</packaging>  7   <version>0.0.1-SNAPSHOT</version>  8   <name>ssh Maven Webapp</name>  9   <url>http://maven.apache.org</url> 10    <repositories>   11    <repository> 12         <id>io.spring.repo.maven.release</id> 13         <url>http://repo.spring.io/release/</url> 14         <snapshots><enabled>false</enabled></snapshots> 15     </repository> 16       <repository>   17           <id>java</id>   18           <name>java official repository</name>   19           <url>http://download.java.net/maven/2/</url>   20       </repository>   21   </repositories>   22   <properties> 23           <servlet-api.version>2.5</servlet-api.version> 24           <jsp-api.version>2.2</jsp-api.version> 25           <jstl.version>1.2</jstl.version> 26         <org.springframework-version>4.0.6.RELEASE</org.springframework-version> 27         <org.hibernate-version>4.3.1.Final</org.hibernate-version> 28         <org.struts-version>2.3.16.3</org.struts-version> 29         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 30     </properties> 31   <dependencies> 32     <dependency> 33       <groupId>junit</groupId> 34       <artifactId>junit</artifactId> 35       <version>3.8.1</version> 36       <scope>test</scope> 37     </dependency> 38     <!--log4j  --> 39     <dependency> 40           <groupId>log4j</groupId> 41           <artifactId>log4j</artifactId> 42           <version>1.2.17</version> 43     </dependency> 44     <!-- Servlet --> 45     <dependency> 46         <groupId>javax.servlet</groupId> 47         <artifactId>servlet-api</artifactId> 48         <version>${servlet-api.version}</version> 49     </dependency> 50     <dependency> 51         <groupId>javax.servlet.jsp</groupId> 52         <artifactId>jsp-api</artifactId> 53         <version>${jsp-api.version}</version> 54     </dependency> 55     <dependency> 56         <groupId>javax.servlet</groupId> 57         <artifactId>jstl</artifactId> 58         <version>${jstl.version}</version> 59     </dependency> 60     <!--struts2 --> 61     <dependency> 62         <groupId>commons-io</groupId> 63         <artifactId>commons-io</artifactId> 64         <version>2.4</version> 65     </dependency> 66     <dependency> 67     <groupId>org.apache.struts</groupId> 68     <artifactId>struts2-core</artifactId> 69     <version>${org.struts-version}</version> 70     </dependency> 71     <dependency> 72         <groupId>org.apache.struts</groupId> 73         <artifactId>struts2-convention-plugin</artifactId> 74         <version>${org.struts-version}</version> 75     </dependency> 76      77     <dependency> 78     <groupId>org.apache.struts</groupId> 79     <artifactId>struts2-spring-plugin</artifactId> 80     <version>${org.struts-version}</version> 81     <!-- struts2-spring-plugin 依赖的是SPRING3,会与SPRING4冲突,需要排除 --> 82     <exclusions> 83         <exclusion>     84             <groupId>org.springframework</groupId> 85             <artifactId>spring-beans</artifactId> 86         </exclusion> 87         <exclusion>     88             <groupId>org.springframework</groupId> 89             <artifactId>spring-core</artifactId> 90         </exclusion> 91         <exclusion>     92             <groupId>org.springframework</groupId> 93             <artifactId>spring-context</artifactId> 94         </exclusion> 95         <exclusion>     96             <groupId>org.springframework</groupId> 97             <artifactId>spring-web</artifactId> 98         </exclusion> 99         100     </exclusions>101     </dependency>102     103     <!-- spring4-->104     <dependency>105         <groupId>org.springframework</groupId>106         <artifactId>spring-context</artifactId>107         <version>${org.springframework-version}</version>108     </dependency> 109     <dependency>110             <groupId>org.springframework</groupId>111             <artifactId>spring-tx</artifactId>112             <version>${org.springframework-version}</version>113         </dependency>114     <dependency>115         <groupId>org.springframework</groupId>116         <artifactId>spring-orm</artifactId>117         <version>${org.springframework-version}</version>118     </dependency>119     <dependency>120         <groupId>org.springframework</groupId>121         <artifactId>spring-web</artifactId>122         <version>${org.springframework-version}</version>123     </dependency>124     <!-- spring aop 需要 -->125     <dependency>126         <groupId>org.aspectj</groupId>127         <artifactId>aspectjweaver</artifactId> 128         <version>1.7.0</version> 129     </dependency> 130     <!-- hibernate -->131     <dependency>132         <groupId>org.hibernate</groupId>133         <artifactId>hibernate-core</artifactId>134         <version>${org.hibernate-version}</version>135     </dependency>136     <dependency>137         <groupId>org.hibernate</groupId>138         <artifactId>hibernate-entitymanager</artifactId>139         <version>${org.hibernate-version}</version>140     </dependency>141     <!-- db -->142     <dependency>143             <groupId>c3p0</groupId>144             <artifactId>c3p0</artifactId>145             <version>0.9.1.2</version>146         </dependency>147         <!-- oracle 11g  -->148         <dependency>149             <groupId>com.oracle</groupId>150             <artifactId>ojdbc6</artifactId>151             <version>11.2.0.1.0</version>152         </dependency>153         <!--sql server 2008  -->154         <dependency>  155             <groupId>com.microsoft.sqlserver</groupId>  156             <artifactId>sqljdbc4</artifactId>  157             <version>4.0</version>  158         </dependency>159         <dependency>160             <groupId>net.sourceforge.jtds</groupId>161             <artifactId>jtds</artifactId>162             <version>1.2.4</version>163     </dependency>164     <dependency>165             <groupId>commons-dbcp</groupId>166             <artifactId>commons-dbcp</artifactId>167             <version>1.2.2</version>168     </dependency>169     <dependency>170     <groupId>org.apache.poi</groupId>171     <artifactId>poi</artifactId>172     <version>3.9</version>173 </dependency>174   </dependencies>175   <build>176     <finalName>ssh</finalName>177   </build>178 </project>
 1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app id="starter" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 5   <display-name>ssh</display-name> 6   <welcome-file-list> 7         <welcome-file>index.jsp</welcome-file> 8     </welcome-file-list> 9      <filter>10         <filter-name>encodingFilter</filter-name>11         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>12         <init-param>13             <param-name>encoding</param-name>14             <param-value>UTF-8</param-value>15         </init-param>16     </filter>17     <filter-mapping>18         <filter-name>encodingFilter</filter-name>19         <url-pattern>/*</url-pattern>20     </filter-mapping>21     <context-param>22         <param-name>log4jConfigLocation</param-name>23         <param-value>/WEB-INF/classes/log4j.properties</param-value>24     </context-param>25     <listener>26         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>27     </listener>28   <context-param>29       <param-name>contextConfigLocation</param-name>30       <param-value>/WEB-INF/classes/spring/**/*.xml</param-value>31   </context-param>32   <listener>33       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>34   </listener>35   <filter>36         <filter-name>struts2</filter-name>37         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>38     </filter>39     <filter-mapping>40         <filter-name>struts2</filter-name>41         <url-pattern>*.action</url-pattern>42     </filter-mapping>43 </web-app>
 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  4     xmlns:context="http://www.springframework.org/schema/context" 5     xmlns:tx="http://www.springframework.org/schema/tx" 6     xmlns:aop="http://www.springframework.org/schema/aop" 7     xsi:schemaLocation="http://www.springframework.org/schema/beans  8                         http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 9                         http://www.springframework.org/schema/context10                         http://www.springframework.org/schema/context/spring-context-4.0.xsd11                         http://www.springframework.org/schema/tx12                         http://www.springframework.org/schema/tx/spring-tx-4.0.xsd13                         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">14     <!-- 注解配置 -->15     <context:annotation-config />16     <context:component-scan base-package="com.ssh"></context:component-scan>17     <context:property-placeholder location="classpath:jdbc.properties"/>18     <!-- HIBERNATE配置 -->19     <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">20         <property name="dataSource" ref="dataSource"></property>21         <property name="hibernateProperties">22             <props>23                 <!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop> -->24                 <!--  <prop key="hibernate.current_session_context_class">thread</prop> -->25                 <!-- <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> -->26                 <prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</prop>27                 <prop key="hibernate.show_sql">true</prop>28                 <prop key="hibernate.format_sql">true</prop>29                <!--  <prop key="hibernate.hbm2ddl.auto">update</prop> -->30             </props>31         </property>32         <property name="packagesToScan">33             <list>34                 <value>com.ssh.domain</value>35             </list>36         </property>37     </bean>38     <!-- 事务配置 -->39     <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">40         <property name="sessionFactory" ref="sessionFactory"></property>41     </bean>    42     <tx:advice id="txAdvice" transaction-manager="txManager">43         <tx:attributes >44              <tx:method name="get*" read-only="true" propagation="REQUIRED" />45              <tx:method name="select*" read-only="true" propagation="REQUIRED"/>46             <tx:method name="load*" read-only="true" propagation="REQUIRED"/>47             <tx:method name="find*" read-only="true" propagation="REQUIRED"/>48             <tx:method name="query*" read-only="true" propagation="REQUIRED"/>49             <tx:method name="read*" read-only="true" propagation="REQUIRED"/>50                         <tx:method name="sync*"/>51             <tx:method name="*" propagation="REQUIRED" rollback-for="Exception"/>52         </tx:attributes>53     </tx:advice>54      <aop:config proxy-target-class="true">55          <aop:pointcut expression="execution(* com.ssh.service.*.*(..))" id="point"/>56          <aop:advisor advice-ref="txAdvice" pointcut-ref="point"/>57      </aop:config>58 </beans>
 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4     xmlns:p="http://www.springframework.org/schema/p" 5     xsi:schemaLocation="http://www.springframework.org/schema/beans 6     http://www.springframework.org/schema/beans/spring-beans.xsd"> 7     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> 8           <property name="driverClass" value="${db.driver}"/> 9           <property name="jdbcUrl" value="${db.url}"/>10         <property name="user" value="${db.username}"/>11         <property name="password" value="${db.password}"/>12         <!--连接池中保留的最小连接数。-->  13         <property name="minPoolSize" value="5"/>  14         <!--连接池中保留的最大连接数。Default: 15 -->  15         <property name="maxPoolSize" value="500"/>  16         <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->  17         <property name="initialPoolSize" value="10"/>  18         <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->  19         <property name="maxIdleTime" value="60"/>  20         <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->  21         <property name="acquireIncrement" value="5"/>  22         <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements  23        属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。  24        如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0-->  25         <property name="maxStatements" value="0"/>  26         <!--连接池用完时客户调用getConnection()后等待获取连接的时间,单位:毫秒。超时后会抛出-->  27          <!--SQLEXCEPTION,如果设置0,则无限等待。Default:0-->  28          <property name="checkoutTimeout" value="100"/>29         <!--每60秒检查所有连接池中的空闲连接。Default: 0 -->  30         <property name="idleConnectionTestPeriod" value="60"/>  31         <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->  32         <property name="acquireRetryAttempts" value="30"/>  33         <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效  34        保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试  35        获取连接失败后该数据源将申明已断开并永久关闭。Default: false-->  36         <property name="breakAfterAcquireFailure" value="false"/>  37         <!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的  38       时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable  39       等方法来提升连接测试的性能。Default: false -->  40         <property name="testConnectionOnCheckout" value="false"/>  41     </bean>42 </beans>
1 #db.driver=oracle.jdbc.driver.OracleDriver2 db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver3 #db.driver=net.sourceforge.jtds.jdbc.Driver4 #db.url=jdbc\:oracle\:thin\:@127.0.0.1\:1521\:orcl5 db.url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=SSH6 #db.username=username7 db.username=sa8 #db.password=password9 db.password=2804118302
 1 ### set log levels ### 2 log4j.rootLogger = error ,  stdout 3   4 ### \u8F93\u51FA\u5230\u63A7\u5236\u53F0 ### 5 log4j.appender.stdout = org.apache.log4j.ConsoleAppender 6 log4j.appender.stdout.Target = System.out 7 log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 8 log4j.appender.stdout.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n 9  10 ### \u8F93\u51FA\u5230\u65E5\u5FD7\u6587\u4EF6 ###11 log4j.appender.D = org.apache.log4j.DailyRollingFileAppender12 log4j.appender.D.File = logs/log.log13 log4j.appender.D.Append = true14 log4j.appender.D.Threshold = DEBUG ## \u8F93\u51FADEBUG\u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD715 log4j.appender.D.layout = org.apache.log4j.PatternLayout16 log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n17  18 ### \u4FDD\u5B58\u5F02\u5E38\u4FE1\u606F\u5230\u5355\u72EC\u6587\u4EF6 ###19 log4j.appender.D = org.apache.log4j.DailyRollingFileAppender20 log4j.appender.D.File = logs/error.log ## \u5F02\u5E38\u65E5\u5FD7\u6587\u4EF6\u540D21 log4j.appender.D.Append = true22 log4j.appender.D.Threshold = ERROR ## \u53EA\u8F93\u51FAERROR\u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD7!!!23 log4j.appender.D.layout = org.apache.log4j.PatternLayout24 log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n
 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE struts PUBLIC 3     "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" 4     "http://struts.apache.org/dtds/struts-2.3.dtd"> 5 <struts> 6     <constant name="struts.i18n.encoding" value="UTF-8" /> 7     <constant name="struts.convention.default.parent.package" value="default-package" />   8     <package name="default-package" extends="convention-default"></package> 9     <constant name="struts.convention.result.path" value="/" />10     <constant name="struts.convention.package.locators" value="action"/> 11     <constant name="struts.convention.action.name.separator" value="-"/> 12     <!-- 将STRUTS 交给SPRING管理 -->13     <constant name="struts.objectFactory" value="spring"></constant>14     <!-- 后缀为.ACTION的全部交给STRUTS处理 -->15     <constant name="struts.action.extension" value="action"></constant>16     <!-- struts 动态方法调用 -->17     <constant name="struts.enable.DynamicMethodInvocation" value="true" />18     <!-- Action名称中是否还是用斜线 -->19     <constant name="struts.enable.SlashesInActionNames" value="false" />20 </struts>

 

ssh maven