Skip to content

Commit

Permalink
1.添加日志,输出到文件
Browse files Browse the repository at this point in the history
2.优化Mapper扫描
  • Loading branch information
dp9212 committed Jul 14, 2017
1 parent daf5acb commit 1250ac6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
<artifactId>qiniu-java-sdk</artifactId>
<version>[7.2.0, 7.2.99]</version>
</dependency>

</dependencies>

<build>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/dp/photo/ViewApplication.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dp.photo;

import com.alibaba.druid.pool.DruidDataSource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand All @@ -13,7 +14,8 @@
@SpringBootApplication
@Configuration
@EnableTransactionManagement
@ServletComponentScan /* 可以不写? */
@ServletComponentScan
@MapperScan("com.dp.photo.mapper") /* mapper扫描,mapper层不用打@Mapper */
public class ViewApplication {

/*配置这个bean后,druid后台才能监控到sql语句 加上@Configuration */
Expand All @@ -23,6 +25,7 @@ public DataSource druidDataSource() {
DruidDataSource druidDataSource = new DruidDataSource();
return druidDataSource;
}

public static void main(String[] args) {
SpringApplication.run(ViewApplication.class, args);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/dp/photo/mapper/BaseMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Created by dp9212 on 2017/6/28.
*/
@Mapper
@Repository
public interface BaseMapper<T> {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/dp/photo/mapper/ClassifyMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* Created by dp9212 on 2017/6/28.
*/
@Mapper
@Repository
public interface ClassifyMapper extends BaseMapper<Classify> {
/* 首页相册展示 */
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/dp/photo/mapper/PhotoMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/**
* Created by dp9212 on 2017/6/28.
*/
@Mapper
@Repository
public interface PhotoMapper extends BaseMapper<Photo> {

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/dp/photo/mapper/UserMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
/**
* Created by dp9212 on 2017/6/28.
*/

@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {
/* 根据用户查找 */

Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 日志
# 日志 debug能记录sql语句
#debug=true 会输出很多信息
logging.level.root=info
# debug级别可以看到sql
logging.level.com.dp.photo=debug
logging.file=E:/java/log/myPhoto.log

# DataSource
spring.datasource.username=root
Expand Down

0 comments on commit 1250ac6

Please sign in to comment.