cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

No bean named "cwsSearchQueryCodec"

bidyadhar_tripathy
Participant
0 Likes
225

Hi All,

We have created a CustomProductController (extends from BaseController) in customwebserviceaddon and installed this addon in customcommercewebservices extension (from ycommercewebservices template).

But when we are injecting cwsSearchQueryCodecin (defined in customcommercewebservices/springmvc-v2-servlet.xml) in CustomProductController , then we are getting error No bean named cwsSearchQueryCodec during server start.

Note : We are not getting errors for beans which are defined in other extension-spring.xml but getting error for beans defined in springmvc-v2-servlet.xml.

Please anyone help me regarding this.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member747843
Active Participant
0 Likes

Hi
Try to move this bean definition to v2-web-spring.xml .

springmvc-v2-servlet.xml is loaded by WebConfig.java (@ImportResource annotation) on the servlet level.
web.xml :

 <servlet>
         <servlet-name>springmvc-v2</servlet-name>
         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
         <init-param>
             <param-name>contextClass</param-name>
             <param-value>
                 org.springframework.web.context.support.AnnotationConfigWebApplicationContext
             </param-value>
         </init-param>
         <init-param>
             <param-name>contextConfigLocation</param-name>
             <param-value>
                 de.hybris.platform.ycommercewebservices.v2.config.WebConfig
             </param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>

Additional config from addons are loaded on the web application level and it looks like servlet context is not visible there
web.xml

 <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>WEB-INF/ycommercewebservices-web-spring.xml</param-value>
 </context-param>
 
bidyadhar_tripathy
Participant
0 Likes

Hi ,

Thank you for the response. I am also getting no bean error for ProductHelperClass (defined with @component annotation), when I am injecting in my custom product controller class. Do you know any possible reason for this issue ?

Thanks

former_member747843
Active Participant
0 Likes

The reason will be the same
Probably component-scan which scan this annotated class is defined in springmvc-v2-servlet.xml .