1.在Pom.xml添加spring-boot-starter-data-cassandra依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-cassandra</artifactId> </dependency> 启动spring boot应用,出现错误: org.springframew…
1.控制器级别@ExceptionHandler public class FooController{           //...     @ExceptionHandler({ CustomException1.class, CustomException2.class })     public void handleException() {         //     } } 作用:只针对@Controller起作用. 弊端: A.每个@Controller类都要写标记@Exce…
错误: org.thymeleaf.exceptions.TemplateInputException: Error resolving template "Hello", template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.TemplateRepository.getTemplate(TemplateReposi…
spring单元測试时发现的问题: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/spring-datasource-mogon.xml]; nested exception is java.io.FileNotFoundException: class path resource […
由于早年在管理领域耕耘了一段时间,完美错过了Spring的活跃期, 多少对这个经典的技术带有一种遗憾的心态在里面的, 从下面的我的生涯手绘图中大概可以看出来我的经历. 最近由于新介入到了工业数字化领域,工作也专注于业务应用, 不怎么搞平台了,平台更多的是采取与友商战略合作的方式, 也有机会重新认识并学习一下这个被完美错过的经典技术. 以下是本次的随记. 一.本次的代码地址 https://github.com/quchunhui/demo-macket/tree/master/springboo…
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean…
第一节:项目内置属性 application.properties配置整个项目的,相当于以前的web.xml: 注意到上一节的访问HelloWorld时,项目路径也没有加:直接是http://localhost:8080/helloWorld; 因为它默认的server.servlet.context-path=/ 修改如下: src/main/resource/application.properties: server.port=8888 server.servlet.context-pat…
延迟消息就是指当消息被发送以后,并不想让消费者立即拿到消息,而是等待指定时间后,消费者才拿到这个消息进行消费. 延迟队列 订单业务: 在电商/点餐中,都有下单后30分钟内没有付款,就自动取消订单. 短信通知:下单成功后60s之后给用户发送短信通知. 失败重试:业务操作失败后,间隔一定的时间进行失败重试. 这类业务的特点就是:非实时的,需要延迟处理,需要进行失败重试.一种比较笨的方法是采用定时任务,轮训数据库,方法简单好用,但性能低下,在高并发情况下容易弄死数据库,间隔时间不好设置,时间过大,影响…
MQ全程(Message Queue)又名消息队列,是一种异步通讯的中间件.可以理解为邮局,发送者将消息投递到邮局,然后邮局帮我们发送给具体的接收者,具体发送过程和时间与我们无关,常见的MQ又kafka.activemq.zeromq.rabbitmq等等. RabbitMQ RabbitMQ是一个遵循AMQP协议,由面向高并发的erlang语言开发而成,用在实时的对可靠性要求比较高的消息传递上,支持多种语言客户端,支持延迟队列. 基础概念 Broker:消息队列的服务器实体 Exchange:…
1. 前言 在Spring Boot项目中我们经常需要读取application.yml配置文件的自定义配置,今天就来罗列一下从yaml读取配置文件的一些常用手段和方法. 2. 使用@Value注解 首先,会想到使用@Value注解,该注解只能去解析yaml文件中的简单类型,并绑定到对象属性中去. felord: phone: 182******32 def: name: 码农小胖哥 blog: felord.cn we-chat: MSW_623 dev: name: 码农小胖哥 blog:…