Beanshell or Groovy :-)
Checking the implementing class of a bean is just one of the many cool things you can do at runtime with Beanshell or Groovy.
Disclaimer: Be careful running Beanshell or Groovy code on a production machine!
Log in to the HAC and go to Console > Beanshell or Groovy
Execute the following code in either Beanshell or Groovy to get your implementing class:
de.hybris.platform.core.Registry.getApplicationContext().getBean("checkoutFacade");
Both consoles will show the result of the last expression in the Result tab.
In the Groovy console for Hybris 5.x, simple execute the following:
checkoutFacade
As you can see, each bean is automatically def
-ed into each Groovy script.
As for Beanshell, you could create a bean
function in Beanshell:
import de.hybris.platform.core.Registry;
import de.hybris.platform.commercefacades.order.CheckoutFacade;
Object bean(String beanName)
{
return Registry.getApplicationContext().getBean(beanName);
}
CheckoutFacade checkoutFacade = (CheckoutFacade) bean("checkoutFacade");
print(checkoutFacade);
I ended up using Beanshell so much that I created my own wrapper application that allows me to develop Beanshell in Eclipse, and use Eclipse as the Beanshell console. But that's a whole other post!
Resources:
- Beanshell User Manual
- Beanshell Commands Documentation (Built-in functions like
print()
)