
springboot
mjlfto
这个作者很懒,什么都没留下…
展开
-
利用SpringBoot自定义一个MQ
前几天面试,面试官说只用springBoot实现一个mq,同时提供生产和消费restful 风格接口,正好疫情期间,在家也没什么事,就简单的模拟kafka实现了一个,通过学者利用SpringBoot自定义了一个starter,作为模块间通信项目连接...原创 2020-02-22 11:49:26 · 513 阅读 · 0 评论 -
Springboot 自定义starter
之前说了SpringBoot的自动配置原理,现在说说一个简单的自定义spring-boot-stater,这个starter的功能很简单,就是没200毫秒在控制台输出当前时间,要注意的是这个spring-boot-stater是一个独立的模块,与我们自己的spring-boot项目只需要用一个注解接口生效,取消这个注解,那么这个功能也就没了,功能描述完了,接下来我们看看代码实现:首先定义一个配置...原创 2020-01-14 23:16:16 · 179 阅读 · 0 评论 -
SpringBoot自动配置
SpringBoot提供了自动配置功能,这样可以让我们更加专注的做我们关注的业务逻辑,而不必过多的去考虑哪些在使用Spring的时候需要考虑的各种配置,例如我们在使用spring webmvc的时候,提供下边这样一段代码,然而,这段代码对于所有使用Spring webMvc而言,基本属于通用,也就是我们添加一个有关webmvc的模块就需要提供这样一段代码,所以springboot有一次做了封装,提...原创 2020-01-14 12:05:11 · 810 阅读 · 0 评论 -
springboot多模块resources共享问题
spring boot 中maven多模块依赖配置文件共享问题,当我们在使用多模块是,可能需要配置一些参数,比如我们将与数据交互操作进行抽取形成了一个独立的模块,当其他模块需要依赖这个模块时,如果不做配置共享处理,那么在依赖模块中也需要和被依赖模块做相同的配置,这样显然非常麻烦而且不合理,我们希望做到同一套配置在依赖模块中也生效,无需重复做相同的配置举例数据库操作模块 : db --> ...原创 2019-04-19 23:08:44 · 10608 阅读 · 0 评论 -
spring boot + mybatis Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDeleg...原创 2018-05-23 15:10:13 · 5095 阅读 · 1 评论 -
spring cloud config server 启动报错
version:spring boot 1.5.10RELEASEspring cloud Edgware.SR2错误信息:Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.20...原创 2018-04-28 10:25:53 · 12484 阅读 · 2 评论 -
The bean 'xxx' could not be injected as a 'xxx'because it is a JDK dynamic proxy that
最近启动springboot项目的时候突然提示以下错误, 完全懵逼,之前的代码完全没有改动过, 过几天突然就报了这么一个错误Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependenc...原创 2018-03-05 11:32:47 · 14790 阅读 · 1 评论 -
springboot cors处理
package com.seengene.ar.conent.restful.restful.config;import org.springframework.boot.web.servlet.FilterRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframewo...原创 2018-02-24 16:48:26 · 656 阅读 · 0 评论 -
springboot mvc 拦截
package com.seengene.ar.conent.restful.restful.config.loginFilter;import com.seengene.ar.conent.restful.restful.entity.Session;import com.seengene.ar.conent.restful.restful.server.RedisServer;impo...原创 2018-02-24 16:47:14 · 527 阅读 · 0 评论 -
springboot 计划任务
从spring3.1开始, 计划任务在spring中实现变得异常的简单,首先通过在配置类注解@EnableScheduling来开启计划任务的支持, 然后在要执行计划的方法上注解@Scheduled,声明这是一个计划任务。 spring通过@Scheduled支持多种类型的计划任务, 包含cron(指定时间执行),fixDelay, fixRate(没多长时间执行)如@Scheduled(c...原创 2018-02-24 16:11:28 · 558 阅读 · 1 评论 -
spring 多线程
package com.seengene.ar.conent.restful.restful.test;import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;import org.springframework.context.annotation.ComponentScan;import org....原创 2018-02-24 15:54:38 · 285 阅读 · 0 评论 -
spring boot + mybatis 多数据源,mysql服务主从读写分离
在后台服务中对mysql采用主从复制,采用读写分离,这样可以大大减轻mysql的压力,当然这种操作需要实时性要求不高,mysql主从服务存在一定的延时一、项目结构图: 二、application.propertiesspring.jpa.database=mysqldatasource.master.url=jdbc:mysql://192.168.199.235:3306/lovewhf?use原创 2017-07-09 22:11:00 · 6700 阅读 · 1 评论 -
spring boot LoginInterceptor(登录拦截器)无法注入bean
spring boot LoginInterceptor(登录拦截器)无法注入bean的问题.源码结构图: LoginInterceptor代码:public class LoginInterceptor implements HandlerInterceptor { @Autowired private HS hs; @Override public boolean原创 2017-03-24 18:07:09 · 26477 阅读 · 1 评论 -
MAVEN 编译spring boot + mybatis 出现 Error parsing Mapper XML.
问题描述:在spring boot + mybatis 在Intellij工具中能正常编译运行, 但是使用maven能编译通过, 无法正确启动,启动时出现一下异常这里写代码片Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' e原创 2017-02-15 18:31:05 · 7791 阅读 · 0 评论