avatar
spring question# Java - 爪哇娇娃
c*n
1
in the book "spring in action", MVC chapter,
the example defines the view-resolver by declaring a bean
class="org.springframework.web.
➥ servlet.view.InternalResourceViewResolver">

/WEB-INF/jsp/


.jsp


but it does not attach the bean anywhere (for example as a property of
the servlet in web.xml )
so how does spring know that this bean is a view resolver? does it decide
that this implements ViewResolver so that it must use this bean for resolver
?? what if I declare multiple beans that implement resolver ?
avatar
q*s
2
他们不是都实现了view resolver了吗,Spirng大概从这里知道的!
avatar
g*g
3
Spring MVC uses a few default beans, all of them can be overwritten
in configuration. If you want to see the details, read the source
code.

【在 c******n 的大作中提到】
: in the book "spring in action", MVC chapter,
: the example defines the view-resolver by declaring a bean
: : class="org.springframework.web.
: ➥ servlet.view.InternalResourceViewResolver">
:
: /WEB-INF/jsp/
:

:
: .jsp

avatar
S*h
4
Spring has quite a lot of autowire built-in. It will automatically detect
the defined bean in the required interface or class and use it if there is
no ambiguity.

【在 c******n 的大作中提到】
: in the book "spring in action", MVC chapter,
: the example defines the view-resolver by declaring a bean
: : class="org.springframework.web.
: ➥ servlet.view.InternalResourceViewResolver">
:
: /WEB-INF/jsp/
:

:
: .jsp

avatar
a*i
5
check
http://static.springsource.org/spring/docs/2.5.x/api/org/spring
this servlet is configed in web.xml
it may detect viewResolver automatically

【在 c******n 的大作中提到】
: in the book "spring in action", MVC chapter,
: the example defines the view-resolver by declaring a bean
: : class="org.springframework.web.
: ➥ servlet.view.InternalResourceViewResolver">
:
: /WEB-INF/jsp/
:

:
: .jsp

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。