Proxying mechanismsSpring creates AOP proxies built at runtime through the use of the
- TypeBuilder API.
+ TypeBuilder API.
Two types of proxies can be created, composition based or
inheritance based. If the target object implements at least one interface
@@ -1608,22 +1608,23 @@ MyInterface myProxyObject2 = (MyInterface)ctx.GetObject("MyObject");
if needed. Please note that in both cases a target method implementation
that calls other methods on the target object will not be advised. To
force inheritance based proxies you should either set the
- ProxyTargetType to true property of a ProxyFactory or
- set the XML namespace element proxy-target-type = true
- when using an AOP schema based configuration.
+ ProxyTargetType property of a
+ ProxyFactory to true or set the XML namespace element
+ proxy-target-type = true when using an AOP schema based
+ configuration.
An important alternative approach to inheritance based proxies is
- disucssed in the next section.
+ discussed in the next section.
- In .NET 2.0 you can define the assembly level attribute,
- InternalsVisibleTo, to allow access of internal interfaces/classes to
+ In .NET 2.0 you can define the InternalsVisibleTo
+ assembly level attribute to allow access of internal interfaces/classes to
specified 'friend' assemblies. If you need to create an AOP proxy on an
- internal class/interface add the following code, [assembly:
- InternalsVisibleTo("Spring.Proxy")] and [assembly:
- InternalsVisibleTo("Spring.DynamicReflection")] to your to AssemblyInfo
- file.
+ internal class/interface [assembly:
+ InternalsVisibleTo("Spring.Proxy")] and [assembly:
+ InternalsVisibleTo("Spring.DynamicReflection")] to your to
+ AssemblyInfo file.InheritanceBasedAopConfigurer
@@ -1638,10 +1639,11 @@ MyInterface myProxyObject2 = (MyInterface)ctx.GetObject("MyObject");
private 'target' field. Interception advice is added directly in the
method body before invoking the base class method.
- To use this new inheritance based proxy described in the note
- above, declare an instance of the InheritanceBasedAopConfigurer, and
- IObjectFactoryPostProcessor, in yoru configuraiton file. Here is an
- example.
+ To use this inheritance based proxy described in the note above,
+ declare an instance of the
+ InheritanceBasedAopConfigurer, and
+ IObjectFactoryPostProcessor, in your configuration
+ file. Here is an example:<object type="Spring.Aop.Framework.AutoProxy.InheritanceBasedAopConfigurer, Spring.Aop">
<property name="ObjectNames">
@@ -1659,9 +1661,9 @@ MyInterface myProxyObject2 = (MyInterface)ctx.GetObject("MyObject");
<object id="debugInterceptor" type="AopPlay.DebugInterceptor, AopPlay"/>
- This configuraiton style is similar to the autoproxy by name
+ This configuration style is similar to the autoproxy by name
approach described here and is
- particuarly appropriate when you want to apply advice to WinForm
+ particularly appropriate when you want to apply advice to Winform
classes.