
spring
文章平均质量分 66
SJZYLC
这个作者很懒,什么都没留下…
展开
-
BeanPostProcessor及使用场景
一、BeanPostProcessor在bean实例化前后可进行的操作。可以通过自定义的bean继承该类,通过注解或xml配置bean,这样在bean被初始化的时候可以调用。二、使用场景1、处理自定义注解。bean可以添加我们自定义的注解,自定义的注解处理方式在该类中实现,如通过注解识别一组或几组bean,在后续的业务处理中根据组bean进行逻辑。2、打印日志,将每个bean的初始化情况打印出来;打印初始化时间等。...原创 2020-10-25 20:49:42 · 4819 阅读 · 0 评论 -
对Spring中StopWatch的理解
StopWatch是什么StopWatch是Spring的一个工具类,用来记录一个或一组任务的执行时间。StopWatch不是线程安全的。主要是验证开发环境的性能,不建议用在生产环境。例子 程序执行总时间 public class StopWatchTest { public static void main(String[] args) { Sto...原创 2019-06-18 17:06:42 · 1450 阅读 · 0 评论 -
maven编译时,spring中的属性打不进去的情况
spring中的属性值是${xxx}形式,在maven的properties中配置了property,在进行maven compile的时候,发现属性名称没问题的前提下值没有被替换。原因是maven的pom文件中缺少配置:<build> <resources> <resource> <directory>src...原创 2019-06-04 11:22:03 · 442 阅读 · 0 评论 -
Spring中BeanUtils.copyProperties源码分析
使用Spring的BeanUtils进行对象拷贝很容易。首先引入响应的jar包:<dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>5.0.7.RE...原创 2018-07-30 14:24:37 · 1904 阅读 · 2 评论 -
Spring4.3之后不再支持velocity
原文:As of Spring Framework 4.3, Velocity support has been deprecated due to six years without active maintenance of the Apache Velocity project. We recommend Spring’s FreeMarker support instead, or Thy...翻译 2018-04-03 07:57:00 · 3374 阅读 · 0 评论 -
Thymeleaf3与Spring5集成报错Could not resolve view with name 'list2' in servlet
通过教程(https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html#integrating-thymeleaf-with-spring)学习,创建的项目。thymeleaf配置:<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr...原创 2018-04-08 17:20:48 · 2656 阅读 · 2 评论 -
spring项目启动报错 cvc-elt.1: Cannot find the declaration of element 'beans'.
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from class path resource [spring-config-xxx.xml] is invalid; nested exception is org.xml.sax.S原创 2016-09-30 08:01:02 · 1308 阅读 · 0 评论 -
spring官网下载pdf说明文档
spring的书籍很多,但是最权威的还是spring的官方文档,每次看都是进入官网,感觉好麻烦,要是能下载下来就好了,我不习惯HTML的说明文档,发现可以下载pdf,以下是说明:进入spring官网:http://spring.io/点击导航栏的“PROJECTS”,在点击“Spring Framework”模块进入详情页,点击“Reference”此时浏览原创 2016-09-03 18:51:51 · 4084 阅读 · 1 评论 -
Spring MVC异常统一处理(包括普通请求异常以及ajax请求异常)
通常SpringMVC对异常的配置都是返回某个jsp视图给用户,但是通过ajax方式发起请求,即使发生异常,前台也无法获得任何异常提示信息。因此需要对异常进行统一的处理,对于普通请求以及ajax请求的异常都有效。1.Spring MVC的异常处理机制Spring MVC 通过HandlerExceptionResolver处理程序的异常,包括处理器映射,数据绑定以及处理器执行时发生的异常。转载 2016-08-20 17:37:18 · 8696 阅读 · 1 评论 -
spring4整合quartz2定时器启动报:batch acquisition of 0 triggers
这是条日志输出,输出这样的内容表示目前没有要执行的trigger,这不是错,而且此时任务不执行。如果要执行,看配置的cron时间,让它配置成在当前一会可执行的时间就行了。比如:当前时间是18:00,cron设置为:0 0 1 * * ?,表示每天凌晨一点执行,启动后当前没有要执行的job,自然会打印batch acquisition of 0 triggers。如果要执行,原创 2016-03-12 18:44:53 · 11624 阅读 · 0 评论 -
spring4.2.5实现调度任务的几种方式
目前spring的最新版本是4.2.5,通过对spring scheduling的学习,总结有几种可以实现调度任务的方式1、注解2、Task命名空间3、使用Quartz调度下面分别介绍实现方式首先引入相关jar包,pom.xml中配置: javax.servlet servlet-api 2.3原创 2016-03-12 17:43:31 · 4416 阅读 · 0 评论 -
使用spring4添加调度任务task的namespace
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="htt原创 2016-03-12 14:36:10 · 2449 阅读 · 0 评论 -
java的main方法中调用spring的service
ApplicationContext ac = new ClassPathXmlApplicationContext("app-all.xml"); IAppService ips = (IAppService) ac.getBean("appService"); System.out.println(ips.getAllList());原创 2015-04-13 19:03:57 · 3508 阅读 · 0 评论