File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
spring-context/src/main/java/org/springframework/scheduling/annotation Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2011 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
105
105
* taskRegistrar.setScheduler(taskExecutor());
106
106
* }
107
107
*
108
- * @Bean
108
+ * @Bean(destroyMethod="shutdown")
109
109
* public Executor taskExecutor() {
110
110
* return Executors.newScheduledThreadPool(100);
111
111
* }
112
112
* }</pre>
113
113
*
114
+ * Note in the example above the use of {@code @Bean(destroyMethod="shutdown")}. This
115
+ * ensures that the task executor is properly shut down when the Spring application
116
+ * context itself is closed.
117
+ *
114
118
* Implementing {@code SchedulingConfigurer} also allows for fine-grained
115
119
* control over task registration via the {@code ScheduledTaskRegistrar}.
116
120
* For example, the following configures the execution of a particular bean
133
137
* );
134
138
* }
135
139
*
136
- * @Bean
140
+ * @Bean(destroyMethod="shutdown")
137
141
* public Executor taskScheduler() {
138
142
* return Executors.newScheduledThreadPool(42);
139
143
* }
You can’t perform that action at this time.
0 commit comments