From 5b880b59b7e7c9c9f2302155922f5f6299efea28 Mon Sep 17 00:00:00 2001 From: javahongxi Date: Sun, 16 Dec 2018 11:26:01 +0800 Subject: [PATCH] dependency optimise, slf4j optimise --- pom.xml | 11 -------- whatsmars-common/pom.xml | 8 ------ whatsmars-dbrouter/pom.xml | 4 +-- .../src/main/resources/sqlmap-config.xml | 2 +- .../whatsmars-dubbo-consumer/pom.xml | 8 ++---- .../src/main/resources/dubbo.properties | 2 +- .../src/main/resources/log4j.xml | 28 ------------------- .../src/main/resources/logback.xml | 14 ++++++++++ .../whatsmars-dubbo-provider-boot/pom.xml | 1 + .../whatsmars-dubbo-provider/pom.xml | 8 ++---- .../src/main/resources/dubbo.properties | 2 +- .../src/main/resources/log4j.xml | 28 ------------------- .../src/main/resources/logback.xml | 14 ++++++++++ .../src/main/resources/sqlmap-config.xml | 2 +- .../whatsmars-earth-support-web/pom.xml | 5 ++-- .../web/service/impl/FileServiceImpl.java | 5 ++-- whatsmars-earth/whatsmars-earth-web/pom.xml | 11 +++----- .../earth/web/controller/MarsController.java | 5 ++-- .../earth/web/controller/NewController.java | 5 ++-- .../web/interceptor/LoginInterceptor.java | 3 -- .../interceptor/PermissionInterceptor.java | 3 -- .../rocketmq-spring-boot-starter/pom.xml | 10 +++---- .../starter/RocketMQAutoConfiguration.java | 2 -- whatsmars-redis/pom.xml | 5 +--- whatsmars-sharding-jdbc/pom.xml | 8 ------ whatsmars-spring-boot/pom.xml | 6 ++++ 26 files changed, 67 insertions(+), 133 deletions(-) delete mode 100644 whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/log4j.xml create mode 100644 whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/logback.xml delete mode 100644 whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/log4j.xml create mode 100644 whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index 02927516..1f966602 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,6 @@ 1.7 2.0 2.9.5 - 1.2.17 2.6 3.2.2 1.11 @@ -102,11 +101,6 @@ - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - com.fasterxml.jackson.core jackson-databind @@ -117,11 +111,6 @@ jackson-annotations ${jackson.version} - - log4j - log4j - ${log4j.version} - commons-lang commons-lang diff --git a/whatsmars-common/pom.xml b/whatsmars-common/pom.xml index 729288a5..ec2ee6c0 100644 --- a/whatsmars-common/pom.xml +++ b/whatsmars-common/pom.xml @@ -97,18 +97,10 @@ dom4j - - com.fasterxml.jackson.core - jackson-core - com.fasterxml.jackson.core jackson-databind - - com.fasterxml.jackson.core - jackson-annotations - diff --git a/whatsmars-dbrouter/pom.xml b/whatsmars-dbrouter/pom.xml index 4597b204..ea19d3a7 100644 --- a/whatsmars-dbrouter/pom.xml +++ b/whatsmars-dbrouter/pom.xml @@ -58,8 +58,8 @@ - log4j - log4j + ch.qos.logback + logback-classic commons-lang diff --git a/whatsmars-dbrouter/src/main/resources/sqlmap-config.xml b/whatsmars-dbrouter/src/main/resources/sqlmap-config.xml index 67cec468..2e5d0c7f 100644 --- a/whatsmars-dbrouter/src/main/resources/sqlmap-config.xml +++ b/whatsmars-dbrouter/src/main/resources/sqlmap-config.xml @@ -4,7 +4,7 @@ - + diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/pom.xml b/whatsmars-dubbo/whatsmars-dubbo-consumer/pom.xml index 5c5b0459..ee95387f 100644 --- a/whatsmars-dubbo/whatsmars-dubbo-consumer/pom.xml +++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/pom.xml @@ -40,12 +40,8 @@ fastjson - log4j - log4j - - - org.slf4j - slf4j-api + ch.qos.logback + logback-classic org.apache.commons diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/dubbo.properties b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/dubbo.properties index 9c8e09f1..5eb2a8b9 100644 --- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/dubbo.properties +++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/dubbo.properties @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ## -dubbo.container=log4j,spring +dubbo.container=logback,spring dubbo.spring.config=classpath*:META-INF/spring/*.xml dubbo.application.name=demo-consumer dubbo.application.owner= diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/log4j.xml b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/log4j.xml deleted file mode 100644 index ae988c35..00000000 --- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/log4j.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/logback.xml b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/logback.xml new file mode 100644 index 00000000..72f8e14c --- /dev/null +++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/logback.xml @@ -0,0 +1,14 @@ + + + + + + %d %5p %40.40c:%4L - %m%n + + + + + + + + \ No newline at end of file diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider-boot/pom.xml b/whatsmars-dubbo/whatsmars-dubbo-provider-boot/pom.xml index 5ba728fe..2c98aa75 100644 --- a/whatsmars-dubbo/whatsmars-dubbo-provider-boot/pom.xml +++ b/whatsmars-dubbo/whatsmars-dubbo-provider-boot/pom.xml @@ -47,6 +47,7 @@ org.springframework.boot spring-boot-starter-test + test diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml b/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml index 583ba1f2..75e0ed51 100644 --- a/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml +++ b/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml @@ -40,12 +40,8 @@ fastjson - log4j - log4j - - - org.slf4j - slf4j-api + ch.qos.logback + logback-classic org.apache.commons diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/dubbo.properties b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/dubbo.properties index 82d3d6a7..69ae37ae 100644 --- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/dubbo.properties +++ b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/dubbo.properties @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ## -dubbo.container=log4j,spring +dubbo.container=logback,spring dubbo.spring.config=classpath*:META-INF/spring/*.xml dubbo.application.name=demo-provider dubbo.application.owner=javahongxi diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/log4j.xml b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/log4j.xml deleted file mode 100644 index ae988c35..00000000 --- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/log4j.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/logback.xml b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/logback.xml new file mode 100644 index 00000000..72f8e14c --- /dev/null +++ b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/logback.xml @@ -0,0 +1,14 @@ + + + + + + %d %5p %40.40c:%4L - %m%n + + + + + + + + \ No newline at end of file diff --git a/whatsmars-earth/whatsmars-earth-dao/src/main/resources/sqlmap-config.xml b/whatsmars-earth/whatsmars-earth-dao/src/main/resources/sqlmap-config.xml index 2b902446..cd7d270a 100644 --- a/whatsmars-earth/whatsmars-earth-dao/src/main/resources/sqlmap-config.xml +++ b/whatsmars-earth/whatsmars-earth-dao/src/main/resources/sqlmap-config.xml @@ -4,7 +4,7 @@ - + diff --git a/whatsmars-earth/whatsmars-earth-support-web/pom.xml b/whatsmars-earth/whatsmars-earth-support-web/pom.xml index 2c2ce99a..e4c49bd5 100644 --- a/whatsmars-earth/whatsmars-earth-support-web/pom.xml +++ b/whatsmars-earth/whatsmars-earth-support-web/pom.xml @@ -80,8 +80,9 @@ - log4j - log4j + org.slf4j + slf4j-log4j12 + 1.7.25 diff --git a/whatsmars-earth/whatsmars-earth-support-web/src/main/java/org/hongxi/whatsmars/earth/support/web/service/impl/FileServiceImpl.java b/whatsmars-earth/whatsmars-earth-support-web/src/main/java/org/hongxi/whatsmars/earth/support/web/service/impl/FileServiceImpl.java index f62cae41..fcb805ef 100644 --- a/whatsmars-earth/whatsmars-earth-support-web/src/main/java/org/hongxi/whatsmars/earth/support/web/service/impl/FileServiceImpl.java +++ b/whatsmars-earth/whatsmars-earth-support-web/src/main/java/org/hongxi/whatsmars/earth/support/web/service/impl/FileServiceImpl.java @@ -1,11 +1,12 @@ package org.hongxi.whatsmars.earth.support.web.service.impl; -import org.apache.log4j.Logger; import org.hongxi.whatsmars.common.ImageSizeEnum; import org.hongxi.whatsmars.common.mongo.GridFSClient; import org.hongxi.whatsmars.common.pojo.Result; import org.hongxi.whatsmars.common.pojo.ResultCode; import org.hongxi.whatsmars.earth.support.web.service.FileService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,7 +20,7 @@ import java.io.InputStream; @Service("fileService") public class FileServiceImpl implements FileService { - protected static final Logger logger = Logger.getLogger(FileService.class); + protected static final Logger logger = LoggerFactory.getLogger(FileService.class); @Autowired private GridFSClient gridFSClient; diff --git a/whatsmars-earth/whatsmars-earth-web/pom.xml b/whatsmars-earth/whatsmars-earth-web/pom.xml index 23fabe71..15d9ac68 100644 --- a/whatsmars-earth/whatsmars-earth-web/pom.xml +++ b/whatsmars-earth/whatsmars-earth-web/pom.xml @@ -47,8 +47,9 @@ - log4j - log4j + org.slf4j + slf4j-log4j12 + 1.7.25 @@ -78,11 +79,6 @@ commons-dbcp - - - com.fasterxml.jackson.core - jackson-core - com.fasterxml.jackson.core jackson-databind @@ -90,6 +86,7 @@ com.fasterxml.jackson.core jackson-annotations + ${jackson.version} diff --git a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/MarsController.java b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/MarsController.java index 21c6dcb3..cb35c100 100644 --- a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/MarsController.java +++ b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/MarsController.java @@ -1,9 +1,10 @@ package org.hongxi.whatsmars.earth.web.controller; +import com.itextpdf.text.log.Logger; +import com.itextpdf.text.log.LoggerFactory; import org.hongxi.whatsmars.common.pojo.Result; import org.hongxi.whatsmars.common.util.ResultHelper; import org.hongxi.whatsmars.earth.service.AccountService; -import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -21,7 +22,7 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/account") public class MarsController extends BaseController { - private Logger accountLogger = Logger.getLogger("account-logger"); + private Logger accountLogger = LoggerFactory.getLogger("account-logger"); @Autowired private AccountService accountService; diff --git a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/NewController.java b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/NewController.java index f06106a3..8b679915 100644 --- a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/NewController.java +++ b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/controller/NewController.java @@ -1,6 +1,7 @@ package org.hongxi.whatsmars.earth.web.controller; -import org.apache.log4j.Logger; +import com.itextpdf.text.log.Logger; +import com.itextpdf.text.log.LoggerFactory; import org.hongxi.whatsmars.common.result.Result; import org.hongxi.whatsmars.common.result.ResultHelper; import org.hongxi.whatsmars.earth.service.UserService; @@ -19,7 +20,7 @@ import org.hongxi.whatsmars.earth.domain.pojo.User; @RequestMapping("/test") public class NewController { - private final Logger logger = Logger.getLogger(getClass()); + private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private UserService userService; diff --git a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/LoginInterceptor.java b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/LoginInterceptor.java index 1357ad1a..47215331 100644 --- a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/LoginInterceptor.java +++ b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/LoginInterceptor.java @@ -7,7 +7,6 @@ import org.hongxi.whatsmars.earth.domain.misc.SystemConfig; import org.hongxi.whatsmars.earth.domain.pojo.User; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; @@ -23,8 +22,6 @@ import java.util.Date; */ public class LoginInterceptor implements HandlerInterceptor{ - protected static final Logger logger = Logger.getLogger(LoginInterceptor.class); - private SystemConfig systemConfig; public void setSystemConfig(SystemConfig systemConfig) { diff --git a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/PermissionInterceptor.java b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/PermissionInterceptor.java index 80f23b67..8e753a0a 100644 --- a/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/PermissionInterceptor.java +++ b/whatsmars-earth/whatsmars-earth-web/src/main/java/org/hongxi/whatsmars/earth/web/interceptor/PermissionInterceptor.java @@ -6,7 +6,6 @@ import org.hongxi.whatsmars.earth.domain.permission.Permission; import org.hongxi.whatsmars.earth.domain.pojo.User; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; import org.springframework.util.CollectionUtils; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; @@ -24,8 +23,6 @@ import java.util.Set; */ public class PermissionInterceptor implements HandlerInterceptor { - protected static final Logger logger = Logger.getLogger(PermissionInterceptor.class); - @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { diff --git a/whatsmars-mq/rocketmq-spring-boot-starter/pom.xml b/whatsmars-mq/rocketmq-spring-boot-starter/pom.xml index ba80549a..535a0867 100644 --- a/whatsmars-mq/rocketmq-spring-boot-starter/pom.xml +++ b/whatsmars-mq/rocketmq-spring-boot-starter/pom.xml @@ -16,6 +16,11 @@ org.springframework.boot spring-boot-starter + + org.springframework.boot + spring-boot-configuration-processor + true + org.apache.rocketmq rocketmq-client @@ -35,11 +40,6 @@ jackson-databind - - org.springframework.boot - spring-boot-configuration-processor - true - org.projectlombok lombok diff --git a/whatsmars-mq/rocketmq-spring-boot-starter/src/main/java/org/apache/rocketmq/spring/starter/RocketMQAutoConfiguration.java b/whatsmars-mq/rocketmq-spring-boot-starter/src/main/java/org/apache/rocketmq/spring/starter/RocketMQAutoConfiguration.java index e7e1f4cf..1ad3b3f4 100644 --- a/whatsmars-mq/rocketmq-spring-boot-starter/src/main/java/org/apache/rocketmq/spring/starter/RocketMQAutoConfiguration.java +++ b/whatsmars-mq/rocketmq-spring-boot-starter/src/main/java/org/apache/rocketmq/spring/starter/RocketMQAutoConfiguration.java @@ -37,7 +37,6 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionValidationException; import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -51,7 +50,6 @@ import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Role; import org.springframework.core.annotation.Order; import org.springframework.core.env.StandardEnvironment; import org.springframework.util.Assert; diff --git a/whatsmars-redis/pom.xml b/whatsmars-redis/pom.xml index 31f0396c..fc924fc7 100644 --- a/whatsmars-redis/pom.xml +++ b/whatsmars-redis/pom.xml @@ -27,10 +27,6 @@ com.alibaba fastjson - - com.fasterxml.jackson.core - jackson-core - com.fasterxml.jackson.core jackson-databind @@ -39,6 +35,7 @@ org.springframework spring-test + test diff --git a/whatsmars-sharding-jdbc/pom.xml b/whatsmars-sharding-jdbc/pom.xml index e02b0d93..bb1c86ec 100644 --- a/whatsmars-sharding-jdbc/pom.xml +++ b/whatsmars-sharding-jdbc/pom.xml @@ -20,10 +20,6 @@ - - org.springframework.boot - spring-boot-starter - io.shardingjdbc sharding-jdbc-core-spring-boot-starter @@ -41,10 +37,6 @@ mysql mysql-connector-java - - org.slf4j - jcl-over-slf4j - ch.qos.logback logback-classic diff --git a/whatsmars-spring-boot/pom.xml b/whatsmars-spring-boot/pom.xml index 5371d9ce..402400b7 100644 --- a/whatsmars-spring-boot/pom.xml +++ b/whatsmars-spring-boot/pom.xml @@ -86,6 +86,12 @@ org.hongxi whatsmars-common 1.0-SNAPSHOT + + + org.mongodb + mongo-java-driver + + -- GitLab