一、 jdbc.properties
spring dao配置
<!-- 配置 读取properties文件 jdbc.properties -->
<context:property-placeholder location="classpath:jdbc.properties" />
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/crm?characterEncoding=utf-8
jdbc.username=root
jdbc.password=root
二、 log4j.properties
- web.xml
<!--使用监听加载log4j的配置文件-->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
- log4j.properties
# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
三、自定义
- controller
//注解在成员变量上
@Value("${fromType.code}")
private String fromTypeCode;
- resource.properties 文件
fromType.code=002
- springmvc.xml
<!-- springmvc配置 -->
<context:property-placeholder location="classpath:resource.properties" />
待续。。。。。环境配置