annotation equivalent of <aop:scoped-proxy> annotation equivalent of <aop:scoped-proxy> spring spring

annotation equivalent of <aop:scoped-proxy>


In Spring 3.0 it can be specified by the proxyMode attribute of @Scope annotation:

@Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES)


in the spring context xml, do something like:

<context:component-scan base-package="com.startup.failure" scoped-proxy="interfaces" />

Note that you would need to write interfaces for all classes in that package, though.


In Spring 2.5.x

If I do in spring-context.xml something like

<context:component-scan base-package="com.startup.failure" scoped-proxy="TARGET_CLASS" />

So this way I don't need my proxied beans to implement interfaces? (using CGLIB not JDK standard).Didn't tested this but i think it should work.Of course you need to have cglib library, you need it with <aop:scoped-proxy> anyway.