![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SpringBoot
henry_2016
这个作者很懒,什么都没留下…
展开
-
Springboot中的SPI 机制
一、从java类加载机制说起java中的类加载器负载加载来自文件系统、网络或者其他来源的类文件。jvm的类加载器默认使用的是双亲委派模式。三种默认的类加载器Bootstrap ClassLoader、Extension ClassLoader和System ClassLoader(Application ClassLoader)每一个中类加载器都确定了从哪一些位置加载文件。于此同时我们也可以通过继承java.lang.classloader实现自己的类加载器。Bootstrap ClassLoad转载 2020-06-27 14:40:42 · 568 阅读 · 0 评论 -
解决方案:SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
在maven打包的时候有如下错误:init......SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-operation (NOP) logger implementationSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.Logging initializ原创 2020-05-11 14:31:01 · 1403 阅读 · 2 评论 -
Tomcat-because there was insufficient free space available after evicting expired cache entries解决方案
今天启动Tomcat的时候出现如下信息:异常信息:19-Mar-2020 16:48:06.947 WARNING [localhost-startStop-1] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/classes/templates/error/...原创 2020-03-19 19:58:39 · 1613 阅读 · 0 评论 -
Tomcat启动Springboot项目,报错LoggerFactory is not a Logback LoggerContext but Logback is on the classpath.
今天用Tomcat启动springboot打的war包时,报如下错误:SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/app/tomcat80/webapps/henry/WEB-INF/lib/slf4j-simple-1.7.22.jar!/org/slf4...原创 2020-03-19 20:31:19 · 1147 阅读 · 0 评论 -
在springboot项目中service层获取当前用户信息
在springboot项目中的controller层可以通过 @RequestAttribute(Requests.CURRENT_USER) ItBaseUser user 获取用户对象信息,但很多时候需要在service层用到当前用户的信息;1、先来看下登录时存入用户信息到cookie中CookieUtil.setCookie(response, Cookies.USER_COOKIE, B...原创 2018-03-15 15:58:25 · 32683 阅读 · 5 评论 -
springboot 统一异常处理
对springboot项目的异常进行统一处理,1、自定义异常类public class UnException extends RuntimeException { protected int status; public UnException(ResponseCode responseCode) { super(responseCode.ge...原创 2018-03-15 15:47:41 · 726 阅读 · 1 评论 -
springboot 关于controller层传递单个参数的校验
关于springboot项目中,controller层对传递对象的校验,可以参照该文进行查看,点击打开链接http://www.cnblogs.com/myinspire/articles/7649027.html本文主要针对controller层中,对于单个参数的校验:1、引入依赖<dependency> <groupId>org.hibernate</gr...原创 2018-03-15 15:35:24 · 19397 阅读 · 1 评论 -
SpringBoot项目,启动时报错 Unable to start EmbeddedWebApplicationContext due to missing 方案
针对SpringBoot项目启动中Unable to start EmbeddedWebApplicationContext due to missing 问题:在这篇文章(http://blog.csdn.net/qq_33996921/article/details/79002583)中提出了一个解决方案,添加了tomcat-embed-jasper包,该包是tomcat用来解析原创 2018-01-08 17:27:56 · 6144 阅读 · 1 评论 -
从eclipse中导入到IDEA中的SpringBoot项目,启动时报错 Unable to start EmbeddedWebApplicationContext due to missing Em
项目在STS工具中编译是没有问题的,但导入到IDEA中,进行启动后报错:需要在pom文件中加入:dependency> groupId>org.apache.tomcat.embedgroupId> artifactId>tomcat-embed-jasperartifactId> scope>compilescope原创 2018-01-08 14:33:06 · 1919 阅读 · 0 评论 -
springboot项目中使用MockMvc 进行测试
import org.hamcrest.Matchers;import org.junit.Before;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework原创 2018-01-17 08:59:16 · 9239 阅读 · 0 评论 -
springboot中静态变量值的注入及子项目间的profile的设置
在springboot项目中,经常会将controller层、service层等作为不同的子项目,我们常常将提供的服务层打包成jar包,在controller所在的web项目中调用,可以在pom文件中引用:前面简单说了一下项目之间的引用,接下来要说下如何实现多环境的配置信息作为静态变量在项目之间的注入,对于application.properties在多环境下的配置可以参照 此文htt原创 2018-01-23 15:37:59 · 3712 阅读 · 2 评论 -
Springboot项目报mybatis的错误,org.apache.ibatis.binding.BindingException:Parameter 'uid' not found.
在Springboot项目中使用了mybatis作为orm模型,项目中报错如下:后经检查是由于在mybatis生成的Mapper文件中,使用了spring提供的org.springframework.data.repository.query.Param包,改成org.apache.ibatis.annotations.Param包就可以。究其原因是由于我在mybatis的xm原创 2018-01-11 16:13:00 · 2714 阅读 · 0 评论