To serialize the session of my spring webapplication i have to change my annotations from
@Controller
@Scope("request")
to
@Controller
@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
is it possible to change the default proxyMode in applicationContext.xml?
I am terribly late on this question, but still would be useful for other people.
You can set up default proxy mode in the XML also.
<beans>
<context:component-scan base-package="org.example" scoped-proxy="interfaces"/>
</beans>
You can change the value of the scoped-proxy
attribute as per your need.
This can also be done using annotation, in a spring boot application.
@SpringBootApplication
@ComponentScan(basePackages = "org.example", scopedProxy = ScopedProxyMode.TARGET_CLASS)
public class SpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootHelloWorldApplication.class, args);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.