Skip to content

Commit

Permalink
slf4j
Browse files Browse the repository at this point in the history
  • Loading branch information
javahongxi committed Dec 16, 2018
1 parent 8de0a4b commit c1a15d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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;
Expand All @@ -13,14 +15,17 @@
@Component
@Order(value = 1)
public class InitRunner implements CommandLineRunner {

private final Logger logger = LoggerFactory.getLogger(getClass());

@Autowired
private UserMapper userMapper;
@Autowired
private MessageService messageService;

@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++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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;
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.*;
Expand All @@ -23,7 +24,7 @@
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@ControllerAdvice(annotations = { RestController.class, Controller.class})
public class AppExceptionHandler {

private Logger logger = LoggerFactory.getLogger(getClass());
private final Logger logger = LoggerFactory.getLogger(getClass());

/**
* 业务异常处理,直接返回异常信息提示
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
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;
Expand All @@ -19,7 +19,7 @@
@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;
Expand Down

0 comments on commit c1a15d1

Please sign in to comment.