相关疑难解决方法(0)

是否可以使用注释连接Spring MVC Interceptor?

是否可以使用注释连接Spring MVC Interceptor,如果是这样,有人可以提供一个如何操作的示例吗?

通过注释通过注释,我指的是尽可能少地在XML配置中做.例如,我在http://www.vaannila.com/spring/spring-interceptors.html找到了这个配置文件;

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:interceptors-ref="loggerInterceptor" />
<bean id="loggerInterceptor" class="com.vaannila.interceptor.LoggerInterceptor" />
Run Code Online (Sandbox Code Playgroud)

你有多少配置可以逃脱?我想是一个@Autowired将删除在第2行显式声明bean的需要,但是也可以用注释去掉第1行吗?

spring annotations spring-mvc autowired interceptor

27
推荐指数
3
解决办法
4万
查看次数

标签 统计

annotations ×1

autowired ×1

interceptor ×1

spring ×1

spring-mvc ×1