Handler Interceptors For Annotation Based Configuration in Spring

Here’s what you need to have in your *-servlet.xml file: <context:annotation-config /> <context:component-scan base-package=”com.travelfusion.tfweb.guide.controller” /> <bean class=”org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping”> <property name=”interceptors”> <ref bean=”myInterceptor” /> </property> </bean> <bean id=”myInterceptor” class=”com.company.MyInterceptor”> <property name=”openingTime”><value>9</value></property> <property name=”closingTime”><value>18</value></property> </bean> And your interceptor class something like: public class