这一节学习spring的配置。
一、spring 配置
emall/src/main/resources/applicationContext.xml 文件配置
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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">
emall/src/main/resources/applicationContext-datasource.xml文件配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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">
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
classpath:datasource.properties
dialect=mysql
emall/src/main/resources/datasource.properties
db.driverLocation=/WEB/java/mysql/mysql-connector-java-5.1.6-bin.jar
db.driverClassName=com.mysql.jdbc.Driver
db.url=jdbc:mysql://192.168.1.103:3306/emall?characterEncoding=utf-8
db.username=emall
db.password=518666
db.initialSize = 20
db.maxActive = 50
db.maxIdle = 20
db.minIdle = 10
db.maxWait = 10
db.defaultAutoCommit = true
db.minEvictableIdleTimeMillis = 3600000
二、logback 配置
emall/src/main/resources/logback.xml
UTF-8
[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n
DEBUG
/WEB/java/tomcat/logs/emall.log
/WEB/java/tomcat/logs/emall.log.%d{yyyy-MM-dd}.gz
true
10
[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n
/WEB/java/tomcat/logs/error.log
/WEB/java/tomcat/logs/error.log.%d{yyyy-MM-dd}.gz
true
10
[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n
ERROR
ACCEPT
DENY
三、ftp 配置
emall/src/main/resources/emall.properties
ftp.server.ip=192.168.1.103
ftp.user=ftpuser
ftp.pass=123456
ftp.server.http.prefix=http://img.emall.com/
三、IDE设置
(1)、开启实时编译make project automatically
(2)、对spring进行编辑
四、Chrome开发神器Restlet Client和fe助手
chrome上边两个非常强大的插件:
fe助手:可以解析json字符串
Restlet Client :可以模拟http请求