The destroy() method can be called by adding a destroy-method attribute to your bean definition.
Using lazy-init (defined on bean definition level) you can tell the BeanFactory to wait with instantiating your bean until it is actually loaded. You can only apply the lazy-init parameter to singletons however.
As for the PortletConfig, there is no way you can do this without writing some custom code (which is reusable for all PortletServices however).
Implement a BeanFactoryPostProcessor and add it to your application context. At startup time (of the context) it will automatically be detected and given the chance to do post processing of beans in the application context.
For example:
Code:
public void postProcessBeanFactory(ConfigurableListableBeanFactory fact) {
Map m = fact.getBeansOfType(PortletServiceProvider.class, false, false);
Iterator it = m.keySet().iterator;
// iterate over beans and invoke the init(PortletConfig) method
}
There is one thing however; you won't be able to combine a lazily initializing bean with the BeanFactoryPostProcessor. Maybe somebody else has a solution for this?
Alef