提交 c1a15d1b 编写于 作者: 武汉红喜's avatar 武汉红喜

slf4j

上级 8de0a4b3
......@@ -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++) {
......
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;
......
......@@ -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());
/**
* 业务异常处理,直接返回异常信息提示
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册