美文网首页
从零搭建springboot工程

从零搭建springboot工程

作者: 左洁 | 来源:发表于2018-01-13 12:37 被阅读0次

spring boot工程搭建 

第一:从官网创建项目https://start.spring.io

第二:idea导入项目

pom.xml

工程结构

程序入口

log4j2.xml

mybatis-generator.xml

搭建项目遇到问题:

第一个问题:maven mybatis-generator:generate失败 Exception getting JDBC Driver

mybatis-generator运行需要在pom插件引入mysql-connector-java包参考链接https://segmentfault.com/q/1010000011580237/a-1020000011580609

第二个问题:整合log4j2时候报错

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/Users/zzm/dubbomaven/dubboRepository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/Users/zzm/dubbomaven/dubboRepository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

Logging system failed to initialize using configuration from 'classpath:log4j2.xml'

java.lang.IllegalStateException: Logback configuration error detected:

ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:16 - no applicable action for [Appenders], current ElementPath  is [[Configuration][Appenders]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:67 - no applicable action for [Console], current ElementPath  is [[Configuration][Appenders][Console]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:28 - no applicable action for [PatternLayout], current ElementPath  is [[Configuration][Appenders][Console][PatternLayout]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:26 - no applicable action for [pattern], current ElementPath  is [[Configuration][Appenders][Console][PatternLayout][pattern]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@9:72 - no applicable action for [File], current ElementPath  is [[Configuration][Appenders][File]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@10:28 - no applicable action for [PatternLayout], current ElementPath  is [[Configuration][Appenders][File][PatternLayout]]

ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:26 - no applicable action for [pattern], current ElementPath  is [[Configuration][Appenders][File][PatternLayout][pattern]]

去掉spring-boot-starter-logging

参考链接

https://www.cnblogs.com/Jason-Xiang/p/6547152.html

https://blog.csdn.net/pp_fzp/article/details/76157114

https://blog.csdn.net/z69183787/article/details/52925567

项目地址:demo地址

相关文章

网友评论

      本文标题:从零搭建springboot工程

      本文链接:https://www.haomeiwen.com/subject/fyrcoxtx.html