Skip to Content
Former Member
Nov 29, 2017 at 01:15 PM

AddToCartController annotated resources null after method body change ?


In the AddToCartController, we have several facades ( cartFacade , accProductFacade, etc ). These are wired up using annotations and were working fine.

I had a requirement to change the method body of addQuickOrderToCart( ) in the AddToCartController . Neither the method signature, nor the annotations were changed by this requirement, only the body of the method. Yet, after the change I see in debug mode that those facade instances are now all null when I use the Quick Order function in the storefront and thus throw NPE's when referenced. What's even more interesting is that the normal addToCart( ) works just fine (i.e. the dependencies are injected as normal).

I found a workaround for this issue by duplicating the method and moving it to another controller, but I would really like to understand how changing the method body could break the dependency injection.

Any ideas ?