我不知道我的代码有什么问题,我的休息服务被调用了两次。
我的控制器类中的注释
@EnableAutoConfiguration
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.test.java")
@Controller
以下是我的示例代码:
休息服务:
@RequestMapping(value="/user", method = RequestMethod.GET)
public String getUserDetails(ModelMap model, @RequestParam(value = "userId") String userId){
log.info("UserId:"+userId);
return "content_home";
}
的web.xml:
<servlet>
<servlet-name>myappname</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
<multipart-config>
<location>\\path\folder\test</location>
<max-file-size>10240</max-file-size>
<max-request-size>51200</max-request-size>
<file-size-threshold>51200</file-size-threshold>
</multipart-config>
</servlet>
<servlet-mapping>
<servlet-name>myappname</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/waffle-filter.xml,
/WEB-INF/myappname-servlet.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
我在tomcat8.5服务器中部署了这个war文件。
我在下面尝试了,所有案例服务都被调用了两次
非常感谢任何建议或帮助。谢谢!