ApplicationContext cannot be entered as a bean, as this does not mean a bean.
Spring provides the ApplicationContextAware interface to provide your application with an easy way to get to the spring context:
public class MyContentProvider extends Panel implements ApplicationContextAware { private ApplicationContext applicationContext; public void setApplicationContext(ApplicationContext ctx) { applicationContext=ctx; } public ApplicationContext getApplicationContext() { return applicationContext; } }
The spring mechanism, creating an instance of the bean, will detect the interface and access the device.
Enter this supplier in your calibration component:
public class MyPanel extends Panel { @SpringBean private MyContentProvider contextProvider; ... }
And use it:
contextProvider.getApplicationContext().getBean("foo");
source share