![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
liweigov
这个作者很懒,什么都没留下…
展开
-
通过Spring实现定时任务
第一步:实现TimerTaskpackage com.demo; import java.util.TimerTask; public class TaskextendsTimerTask { public void run() { //ti原创 2011-07-23 14:51:52 · 212 阅读 · 0 评论 -
Servlet获取Spring bean
场景:有时在servlet中需要使用Spring bean,如上传图片等 处理方法:重写Servlet的init方法,通过WebApplicationContextUtils获得,代码如下: public void init() throws ServletException {原创 2011-07-23 15:09:23 · 621 阅读 · 0 评论 -
通过实现ApplicationContextAware接口获取bean
场景:在某个bean中需要动态获取其它bean 实例代码:packageorg.company.xxx; importorg.springframework.beans.BeansException; importorg.springframework.context.App原创 2011-07-23 15:16:47 · 593 阅读 · 0 评论 -
Spring-quartz定时任务
背景: 需要在每天固定某个时间触发 实现: 通过Spring-quartz定时任务实现 1、定义定时任务执行类,不需实现或继承任何借口或抽象类 /** * 测试定时任务 */ package com.test.TestTrigger; public class TestTrigger{ /** * 定时任务调用方法 */ public void myTrigger(转载 2011-11-11 14:03:39 · 672 阅读 · 0 评论 -
Spring线程池ThreadPoolTaskExecutor
1.配置 <!-- spring thread pool executor --> <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <!-- 线程池维护线程的最少数量 -...转载 2019-08-07 13:59:06 · 173 阅读 · 0 评论