spring mvc interceptor configuration

 

	<!-- springMVC interceptor-->
	<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/*"/>
			<bean class="com.app.interceptor.AppHandleRequestInterceptor"></bean>
		</mvc:interceptor>
	</mvc:interceptors>

It was originally configured in spring-mvc.xml, but when accessing the address: http://localhost:8080/myproject/book/bookList, it did not enter the interceptor.

 

If it is the address: http://localhost:8080/myproject/index, you can enter.

 

Modification 1:

<mvc:mapping path="/"/>

Interception failed.

 

Modification 2:

<mvc:mapping path="/*/*"/>

Both are fine, but not if you change to http://localhost:8080/myproject/index/book/bookList.

 

Modification 3

<mvc:mapping path="/**"/>

It will be all right.

 

According to the requirements, choose the interception path, and choose the second one if there are regulations in the project.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326472401&siteId=291194637