原贴:http://www.52pojie.cn/forum.php? ... ;page=2#pid15263920
进行一些补充:
controller 层 原先每个方法前的@ResponseBody 可以不用写 但是必须把@controller 更换成@RestController
这次还补充了日志
pom.xml
日志我用了log4j
[Java] 纯文本查看 复制代码 <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
web.xml
[Java] 纯文本查看 复制代码 <!-- log4j配置begin -->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>60000</param-value>
</context-param>
<!-- log4j配置end -->
resources包下新增个jdbc.properties
[Java] 纯文本查看 复制代码 ### Eclipse Console Configuration ###
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} %F %M %L %m%n
### Backup File Configuration ###
log4j.appender.fileout=org.apache.log4j.RollingFileAppender
log4j.appender.fileout.File=d:\\logs\\pojie.log
log4j.appender.fileout.File.MaxFileSize=1MB
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
log4j.appender.fileout.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss} %l %m%n
### Out Message Level ###
log4j.rootLogger=INFO, stdout, fileout
log4j.logger.org.apache.jasper = INFO
log4j.logger.com.ibatis=INFO
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=INFO
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=INFO
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=INFO
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.org.springframework=INFO
好了 然后我们看下效果
效果是可以的,本地也有了! 好了先这样 大家给点评分 给点动力吧!
|