Spring Interceptors .NET & Constructor

I try to do some AOP on objects at build time and find an IConstructorInterceptor that would be ideal for what I want, but it does not (at least in version 1.2).

I also looked at both IObjectPostProcessor and IInstantiationAwareObjectPostProcessor, but I cannot find a way to process the object around the build time ... The PostProcessPropertyValues ​​method on IInstantiationAwareObjectPostProcessor is close, but it only passes through the setter injected properties, not the arg constructor value ...

In particular, what I want is a reference to an object immediately after creating the instance and at the same time a reference to the objects that were entered into the constructor. Is there a way to do this, or is it a better choice to just switch to insert setup and use a mail processor or MethodInterceptor?

+3
source share
1 answer

AOP offers call pickup rather than dependency injection. Using Spring.Net, you can use installers or constructors to perform any dependency injection. For your post and comments, it should work.

Spring.Net, , . , "Spring.Objects.Factory.IInitializingObject", "void AfterPropertiesSet();" . , , init- node. IoC/DI.

, factory. , factory Spring.Objects.Factory.IFactoryObject. ( factory).

0

Source: https://habr.com/ru/post/1706091/


All Articles