java - Hippo CMS Component (Spring managed) in a catalog (Howto use a spring managed catalog component) -
i having problems setting spring in hippo cms in combination catalog.
i had catalog configured componentclassname:servicelinklistcomponent drag & drop component placeholder on page in channel manager.
after following example @ http://svn.onehippo.org/repos/hippo/hippo-cms7/testsuite/trunk/ added spring support had change componentclassname componentclassname:springbridgehstcomponent
unfortunately can't link document component anymore cause @parametersinfo not recognized cause resides within bean in springbridgehstcomponent.
how can use spring managed catalog component?
component class
@parametersinfo(type = servicelinklistcomponentinfo.class) @component @scope(value = "prototype") public class servicelinklistcomponent extends commoncomponent { private static logger log = loggerfactory.getlogger(servicelinklistcomponent.class); @autowired public testservice testservice; @override public void dobeforerender(final hstrequest request, final hstresponse response) { super.dobeforerender(request, response); final servicelinklistcomponentinfo paraminfo = getcomponentparametersinfo(request); final string documentpath = paraminfo.getdocument(); log.debug("calling essentialsdocumentcomponent document path: [{}]", documentpath); //string test = testservice.test(); setcontentbeanforpath(documentpath, request, response); request.setattribute(request_attr_param_info, paraminfo); } } service class
@component("testservice") public class testservice { public string test(){ return "hello"; } } applicationcontext.xml (in resources/meta-inf.hst-assembly.overrides)
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.xxx.yyy" /> </beans> repo
i found way want consider dirty workaround. maybe people hippocms can here.
i created class:
@parametersinfo(type = servicelinklistcomponentinfo.class) public class servicelinklistspringhstcomponent extends springbridgehstcomponent {} this class needs set in catalog (instead springbridgehstcomponent). tried nested class rid of second file hippo doesn't find it.

Comments
Post a Comment