Commit 18eb5a2
committed
Take the servlet context from the container, not a bean reference
The bean-definition wrap mode wired the resolver's ServletContext as a
RuntimeBeanReference to the "servletContext" bean. That bean is registered by
the container when the web server starts, so it exists only at runtime and has
no bean definition at all. Spring's ahead-of-time processing refreshes the
context without starting a web server, and determining the wrapper's
constructor requires the type of every supplied argument, so the reference
fails the whole run:
AotBeanProcessingException: Error processing bean with name 'jspViewResolver'
Caused by: NoSuchBeanDefinitionException: No bean named 'servletContext' available
SiteMeshViewResolver now implements ServletContextAware and takes its context
from the container, which is how a servlet-scoped collaborator is normally
supplied and leaves nothing in the definition to resolve early. A three-argument
constructor is added for that path; the four-argument one stays for callers that
build the resolver themselves, including the instance-level
SiteMeshViewResolverBeanPostProcessor, which constructs it outside any aware
callback. servletContextBeanName is deprecated on the definition post-processor,
where it no longer has an effect.1 parent eacfc70 commit 18eb5a2
2 files changed
Lines changed: 51 additions & 6 deletions
File tree
- spring-webmvc-sitemesh/src/main/java/org/sitemesh/webmvc
Lines changed: 36 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
57 | 76 | | |
58 | 77 | | |
59 | 78 | | |
| |||
79 | 98 | | |
80 | 99 | | |
81 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
82 | 115 | | |
83 | 116 | | |
84 | 117 | | |
| |||
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
117 | | - | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
312 | 320 | | |
| 321 | + | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
| |||
319 | 328 | | |
320 | 329 | | |
321 | 330 | | |
| 331 | + | |
| 332 | + | |
322 | 333 | | |
| 334 | + | |
323 | 335 | | |
324 | 336 | | |
325 | 337 | | |
| |||
0 commit comments