IntelliJ IDEA 中 ssh的基本配置
来源:互联网 发布:干部网络大学堂 编辑:程序博客网 时间:2024/05/18 02:58
1.新建idea项目
2.配置open model setting
3.Modules > sources 改变目录结构
1)新建resources并点击Resouces
2)WEB-INF下新建classes和lib文件
3)修改Paths中的Compiler output的路径为新建的classes路径
4)保存修改
4.配置tomcat
1)点击配置tomcat
2)点击左上角的加号
3)选择tomcat > local(若没有点击最下面会出现给选项)
4)修改内部的部分配置
5.配置ssh框架
1)导入需要使用的jar包
C3p0数据库连接池
Hibernate
Spring
Struts
配置各个文件
1.Web.xml
文件文档约束
<?xml version="1.0"encoding="UTF-8"?>
<web-appxmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
引入Spring
<!-- spring 配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
引入struts
<!-- struts配置 -->
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
欢迎界面
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
2.Struts.xml
<?xml version="1.0"encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 开发模式下使用,这样可以打印出更详细的错误信息 产品发布时改为false 发布时不需要打印错误信息-->
<constantname="struts.devMode"value="true"></constant>
<!--导入外部的struts文件-->
<!--<include file="com/lyzyxy/jxjy/admin/conf/admin-struts.xml" />-->
<packagename="test"namespace="/test"extends="json-default">
<actionname="test"class="testAction">
<resultname="success">/WEB-INF/jsp/test.jsp</result>
</action>
</package>
</struts>
3.beans.xml
<?xml version="1.0"encoding="UTF-8"?>
<beansxmlns="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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- 2.加载外部配置文件 -->
<context:property-placeholderlocation="classpath:jdbc.properties"/>
<!-- 3.配置数据库连接池 -->
<beanid="dataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!-- 配置连接池属性-->
<propertyname="driverClass"value="${datasource.driverClassName}"/>
<propertyname="jdbcUrl"value="${datasource.url}"/>
<propertyname="user"value="${datasource.username}"/>
<propertyname="password"value="${datasource.password}"/>
<!-- 配置C3p0属性 -->
<propertyname="maxPoolSize"value="${c3p0.maxPoolSize}"/>
<propertyname="minPoolSize"value="${c3p0.minPoolSize}"/>
<!-- 关闭链接后不自动Commit -->
<propertyname="autoCommitOnClose"value="false"/>
<!-- 获取链接的等待时间 -->
<propertyname="checkoutTimeout"value="${c3p0.checkOutTime}"/>
<!-- 获取链接重试次数 -->
<propertyname="acquireRetryAttempts"value="${c3p0.acquireIncrement}"/>
</bean>
<!-- 4.配置SessionFactory -->
<beanid="sessionFactory"class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<propertyname="dataSource"ref="dataSource"/>
<propertyname="hibernateProperties">
<props>
<propkey="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<propkey="hibernate.show_sql">false</prop>
<propkey="hibernate.format_sql">true</prop>
<propkey="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
<propertyname="mappingLocations">
<list>
<!-- .hbm.xml文件的路径 -->
<value>classpath:mapping/*.hbm.xml</value>
</list>
</property>
</bean>
<!-- 5.配置声明式事务管理 -->
<beanid="transactionManager"class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
<!-- 6.配置事务通知 -->
<tx:adviceid="txAdvice"transaction-manager="transactionManager">
<tx:attributes>
<tx:methodname="find*"read-only="true"propagation="SUPPORTS"/>
<tx:methodname="get*"read-only="true"propagation="SUPPORTS"/>
<tx:methodname="list*"read-only="true" propagation="SUPPORTS"/>
<tx:methodname="save*"propagation="REQUIRED"/>
<tx:methodname="add*"propagation="REQUIRED"/>
<tx:methodname="update*"propagation="REQUIRED"/>
<tx:methodname="delete*"propagation="REQUIRED"/>
<tx:methodname="*"rollback-for="Throwable"/>
</tx:attributes>
</tx:advice>
<!-- aop配置被事务控制的类 -->
<aop:config>
<!-- 修改expression为 自己的位置-->
<aop:pointcutid="serviceOperation"expression="execution(* sshtest..*.service.impl.*.*(..) )"/>
<aop:advisoradvice-ref="txAdvice"pointcut-ref="serviceOperation"/>
</aop:config>
<!--<bean name="baseDao" abstract="true" >-->
<!--<property name="sessionFactory" ref="sessionFactory"/>-->
<!--</bean>-->
<!-- 自动扫描base package 如果发现 @Controller 注入 -->
<context:component-scanbase-package="sshtest"/>
<!--添加dao-->
<!--<import resource="classpath:com/lyzyxy/jxjy/*/conf/*-spring.xml"/>-->
</beans>
4.Struts.xml
<?xml version="1.0"encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 开发模式下使用,这样可以打印出更详细的错误信息 产品发布时改为false 发布时不需要打印错误信息-->
<constantname="struts.devMode"value="true"></constant>
<!--导入外部的struts文件-->
<!--<include file="com/lyzyxy/jxjy/admin/conf/admin-struts.xml" />-->
<packagename="test"namespace="/test"extends="json-default">
<actionname="test"class="testAction">
<resultname="success">/WEB-INF/jsp/test.jsp</result>
</action>
</package>
</struts>
6.log4j.properties
### set log levels ###
log4j.rootLogger =debug,stdout,D,E
### 输出到控制台 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target =System.out
log4j.appender.stdout.layout =org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
### 输出到日志文件 ###
log4j.appender.D =org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = src/logs/log.log
log4j.appender.D.Append =true
## 输出DEBUG级别以上的日志###
log4j.appender.D.Threshold = DEBUG
log4j.appender.D.layout =org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern= %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
### 保存异常信息到单独文件 ###
log4j.appender.E =org.apache.log4j.DailyRollingFileAppender
## 异常日志文件名
log4j.appender.E.File = src/logs/error.log
log4j.appender.E.Append =true
## 只输出ERROR级别以上的日志!!!
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout =org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern= %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
log4j.logger.com.lyzyxy=debug
7.Jdbc.propoties
datasource.driverClassName=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://localhost:3306/lyzyxy?useUnicode=true&characterEncoding=UTF8
datasource.username=root
datasource.password=1240845161
c3p0.acquireIncrement=3
c3p0.initialPoolSize=3
c3p0.idleConnectionTestPeriod=60
c3p0.minPoolSize=5
c3p0.maxPoolSize=100
c3p0.maxStatements=100
c3p0.numHelperThreads=10
c3p0.maxIdleTime=60
c3p0.checkOutTime=3000
- IntelliJ IDEA 中 ssh的基本配置
- Intellij IDEA基本配置
- IntelliJ IDEA基本配置
- IntelliJ IDEA 基本配置入门
- IntelliJ IDEA 基本配置入门
- IntelliJ IDEA 基本配置入门
- IntelliJ IDEA 基本配置入门
- IntelliJ IDEA 基本配置入门
- IntelliJ IDEA 基本配置入门
- Intellij idea 中 JUnit 的简单配置
- Intellij IDEA的基本使用
- Intellij IDEA中serialVersionUID配置
- Intellij IDEA-IDEA中配置Maven Tomcat
- IntelliJ IDEA的一些配置
- 修改intellij idea的配置
- IntelliJ IDEA的使用配置
- Intellij idea的tomcat配置
- IntelliJ IDEA中Tomcat的安装和配置
- LeetCode Weekly Contest 13-HammingDistance【易】
- error C2078: 初始值设定项太多;error C2664: 不能将参数 1 从“char”转换为“const char *
- 微信小程序填坑之路(三)--上传头像
- Delphi中CoInitialize之探究
- Sqrt(x)
- IntelliJ IDEA 中 ssh的基本配置
- mobiscroll js日期插件的基本案例
- mybatis-generator扩展教程系列 -- mapper xml文件增加自定义sql
- git: push免输用户名和密码
- Delphi窗体重绘API:DrawFocusRect,SetTextColor(),GetDc,GetWindowDC,MapWindowPoints,InflateRect
- Uploadify IE出现了SCRIPT5007 缺少对象
- 排序算法 - 插入排序
- spring源码剖析之Spring Security安全框架
- Leetcode Find Minimum in Rotated Sorted Array