diff --git a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/InitRunner.java b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/InitRunner.java index 9c0794402ee42b1e597b962c5918990e307388b5..6cb909789eaf6b380e6dbeb0425847cd0829dee6 100644 --- a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/InitRunner.java +++ b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/InitRunner.java @@ -2,6 +2,8 @@ package org.hongxi.whatsmars.spring.boot.controller; import org.hongxi.whatsmars.spring.boot.async.MessageService; import org.hongxi.whatsmars.spring.boot.dao.UserMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; @@ -13,6 +15,9 @@ import org.springframework.stereotype.Component; @Component @Order(value = 1) public class InitRunner implements CommandLineRunner { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired private UserMapper userMapper; @Autowired @@ -20,7 +25,7 @@ public class InitRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { - System.out.println("init......createIfNotExistsTable"); + logger.info("init......createIfNotExistsTable"); userMapper.createIfNotExistsTable(); for (int i = 0; i < 10; i++) { diff --git a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/UserController.java b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/UserController.java index caa98a82a2106348748dfc5af7394c11aa4b7e05..ff741f7b2b94902a543c634e2f0bd5e2f559bd4e 100644 --- a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/UserController.java +++ b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/controller/UserController.java @@ -1,7 +1,6 @@ package org.hongxi.whatsmars.spring.boot.controller; import com.github.pagehelper.Page; -import org.apache.logging.log4j.LogManager; import org.hongxi.whatsmars.common.result.Result; import org.hongxi.whatsmars.common.result.ResultHelper; import org.hongxi.whatsmars.spring.boot.common.ReturnItemUtils; @@ -9,6 +8,8 @@ import org.hongxi.whatsmars.spring.boot.common.pojo.ReturnItems; import org.hongxi.whatsmars.spring.boot.exception.AppException; import org.hongxi.whatsmars.spring.boot.model.User; import org.hongxi.whatsmars.spring.boot.service.UserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; @@ -23,7 +24,7 @@ import java.util.*; @RequestMapping("/user") public class UserController { - private final org.apache.logging.log4j.Logger logger = LogManager.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private UserService userService; diff --git a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/exception/AppExceptionHandler.java b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/exception/AppExceptionHandler.java index 720520e16a81bcba4947b2e0b55ed7f7945e1b34..aaadcc8136883b169e8b699c1b2b814d02eef665 100644 --- a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/exception/AppExceptionHandler.java +++ b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/exception/AppExceptionHandler.java @@ -24,7 +24,7 @@ import java.util.Map; @ControllerAdvice(annotations = { RestController.class, Controller.class}) public class AppExceptionHandler { - private Logger logger = LoggerFactory.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); /** * 业务异常处理,直接返回异常信息提示 diff --git a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/service/impl/UserServiceImpl.java b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/service/impl/UserServiceImpl.java index 5fece057a580dfaa7710bfcf452a91450fb46948..6869b908d5687eaba637dc64930e1b84c08a0228 100644 --- a/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/service/impl/UserServiceImpl.java +++ b/whatsmars-spring-boot/src/main/java/org/hongxi/whatsmars/spring/boot/service/impl/UserServiceImpl.java @@ -5,8 +5,8 @@ import com.github.pagehelper.PageHelper; import org.hongxi.whatsmars.spring.boot.dao.UserMapper; import org.hongxi.whatsmars.spring.boot.model.User; import org.hongxi.whatsmars.spring.boot.service.UserService; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -19,7 +19,7 @@ import java.util.List; @Service("userService") public class UserServiceImpl implements UserService { - private final Logger logger = LogManager.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private UserMapper userMapper;