Hi Tlabs,
At this moment, SpringBridgeHstComponent finds the delegatee bean by
using
org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(ServletContext)(servletContext);
As a result, it cannot find the delegatee bean unless the bean is
defined in the root web application context configuration, which is
loaded by org.springframework.web.context.ContextLoaderListener by
default from /WEB-INF/applicationContext.xml (which can be configured to
a different location by setting 'contextConfigLocation' servlet context
init param). See [1] for detail on ContextLoaderListener.
So, if you define your bean in /WEB-INF/applicationContext.xml and if
you have the following in /WEB-INF/web.xml,
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
then it will work without any problem.
I also gave another thought to improve this in HST-2:
- Spring dispatcher servlet allows to expose its own
WebApplicationContext as servlet context attribute through init parameters;
- So, if SpringBridgeHstComponent (and others) are able to retrieve a
WebApplicationContext through
org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(ServletContext)(servletContext,
attrName) with attrName parameterized from somewhere, then it might be
more convenient without having to define the root application context
configuration.
Please review if my first suggestion would work for you.
Or if you like the improvement, then please feel free to file a JIRA
issue here:
-
https://issues.onehippo.com/browse/HSTTWO/
Cheers,
Woonsan
[1]
http://docs.spring.io/spring/docs/3.2.11.RELEASE/spring-framework-reference/htmlsingle/
("5.14.4 Convenient ApplicationContext instantiation for web applications")
> --
> Hippo Community Group: The place for all discussions and announcements
> about Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to
hippo-c...@googlegroups.com
> RSS:
>
https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google
> Groups "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
hippo-communi...@googlegroups.com
> <mailto:
hippo-communi...@googlegroups.com>.
> Visit this group at
http://groups.google.com/group/hippo-community.
> For more options, visit
https://groups.google.com/d/optout.
--
w....@onehippo.com www.onehippo.com
Boston - 101 Main Street, Cambridge, MA 02142
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US
+1 877 414 4776 (toll free)
Europe
+31(0)20 522 4466