|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2016 the original author or authors. |
| 2 | + * Copyright 2002-2022 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.
|
@@ -78,26 +78,26 @@ public int getOrder() {
|
78 | 78 | @Override
|
79 | 79 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
80 | 80 | for (ViewResolver viewResolver : this.viewResolvers) {
|
81 |
| - if (viewResolver instanceof ApplicationContextAware) { |
82 |
| - ((ApplicationContextAware)viewResolver).setApplicationContext(applicationContext); |
| 81 | + if (viewResolver instanceof ApplicationContextAware applicationContextAware) { |
| 82 | + applicationContextAware.setApplicationContext(applicationContext); |
83 | 83 | }
|
84 | 84 | }
|
85 | 85 | }
|
86 | 86 |
|
87 | 87 | @Override
|
88 | 88 | public void setServletContext(ServletContext servletContext) {
|
89 | 89 | for (ViewResolver viewResolver : this.viewResolvers) {
|
90 |
| - if (viewResolver instanceof ServletContextAware) { |
91 |
| - ((ServletContextAware)viewResolver).setServletContext(servletContext); |
| 90 | + if (viewResolver instanceof ServletContextAware servletContextAware) { |
| 91 | + servletContextAware.setServletContext(servletContext); |
92 | 92 | }
|
93 | 93 | }
|
94 | 94 | }
|
95 | 95 |
|
96 | 96 | @Override
|
97 | 97 | public void afterPropertiesSet() throws Exception {
|
98 | 98 | for (ViewResolver viewResolver : this.viewResolvers) {
|
99 |
| - if (viewResolver instanceof InitializingBean) { |
100 |
| - ((InitializingBean) viewResolver).afterPropertiesSet(); |
| 99 | + if (viewResolver instanceof InitializingBean initializingBean) { |
| 100 | + initializingBean.afterPropertiesSet(); |
101 | 101 | }
|
102 | 102 | }
|
103 | 103 | }
|
|
0 commit comments