Creating CMS component as Addon .
Creating a new CMS component and controller with addon1) Create addon:Run ‘ant extgen’ in platform folder.Type/select ‘yaddon’ templateProvide required extension details.Provide required package details.2) Add new addon extension in localextensions.xml of Config folder.3) Create new CMS component in *-items.xml.This is the place for data modeling.
<itemtype code="xxxxxxComponent" autocreate="true" generate="true" extends="SimpleCMSComponent"
jaloclass="xxxxxxComponent">
<attributes>
<attribute type="xxxxl" qualifier="xxxx">
<persistence type="property" />
<modifiers optional="false" />
<defaultvalue>
</defaultvalue>
</attribute>
</itemtype>
4)
Add entry in XXXXX-locales_en.propertiestype.xxxxxxComponent.name = …… 5) As new component extends cms component , so set dependency in eclipse and extensioninfo.xml. name="cms2"/>6) Ant all and do system update.Update with options ‘Update Running System’ and ‘Localized types’.7) Create JSP with name as new component type in small case(xxxxxxComponent).
8)
Create a controller and extend AbstractCMSAddOnComponentController.a. Add your logic by overriding fillModel().b. Add required notations
@Controller("xxxxxxComponentController")
@Scope("tenant")
@RequestMapping(value = ControllerConstants.Actions.Cms. xxxxxxComponent)
9) Define controller :
set context:component-scan on *-web-spring.xml
<bean id=" xxxxxxComponentController " class="de.hybris.platform.addons.recentlyviewedproductsaddon.controllers. xxxxxxComponentController" scope="tenant">
</bean>
10)Building the AddOn ant addoninstall -Daddonnames="XXX(addon name)XX" -DaddonStorefront.yacceleratorstorefront="XXXstorefront"11) Run ant all12)Add the new component to required section/template/.. of a page in HMC.13)Now new component is available to use in the location as declared above. 









