Details
-
Improvement
-
Resolution: Won't Do
-
Neutral
-
None
-
5.4.4
-
None
Description
A component will be instantiated by guice, so they can also be scanned for interceptors. This however is not valid for model classes themselves.
I discovered this when I naively set a @CacheResult annotation on a method in a model class too (using https://github.com/vpro/jsr107-magnolia)
A component which we wire in a model class gets instantiated in com.google.inject.internal.ConstructorInjector#line 85
try {
Object[] parameters = SingleParameterInjector.getAll(errors, context, parameterInjectors);
t = constructionProxy.newInstance(parameters);
constructionContext.setProxyDelegates(t);
} finally {
The model itself gets instantiated like this in info.magnolia.objectfactory.ObjectManufacturer#line line 118
private Object newInstance(Constructor constructor, Object[] parameters) { try { return constructor.newInstance(parameters); } catch (InstantiationException e) { throw new MgnlInstantiationException(e); } catch (IllegalAccessException e) { throw new MgnlInstantiationException(e); } catch (InvocationTargetException e) { throw new MgnlInstantiationException(e); } }
Checklists
Acceptance criteria