在spring-mvc.xml文件中,进行以下配置,就可以实现在Controller中,

方法一:

最简单的,在spring-mvc.xml配置文件中,添加以下语句

spring-mvc.xml

<!-- 激活自动代理功能 -->
<aop:aspectj-autoproxy proxy-target-class="true"/>

以前,这句代码,我们放在了spring.xml中。

方法二:

与方法一类似,也是在spring-mvc.xml配置文件中,添加以下语句

<!-- 激活自动代理功能 -->
<aop:aspectj-autoproxy proxy-target-class="true" >
    <aop:include name="dataSourceAspect" />
</aop:aspectj-autoproxy>

<bean  />

方法三:

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-04-22
  • 2022-12-23
相关资源
相似解决方案