我有一个简单的春季启动应用程序,每次,DispatcherServlet处理一些我不知道它来自哪里。当我调用任何REST API时,会在实际的API之前调用它。
这是调试中的消息。如果我错过了基础知识,任何人都可以指导我。
DispatcherServlet with name 'dispatcherServlet' processing POST request for [/login]
实际上我有一个带有此名称的映射API,因此不确定如何设置
这是我的控制器,当我调用/ getUserInfo时,也会调用/ login。我的整个控制器都是用@RestController注释的。
@RequestMapping(value = "/login", method = RequestMethod.POST)
public List<User> login(@RequestParam(value = "userID") String userID,@RequestParam(value = "userPassword" ) String userPassword) {
return service.checkUser(userEmail, userPassword, repository);
}
@RequestMapping(value = "/getUserInfo", method = RequestMethod.GET)
public User getUserInfo(@RequestParam("userID") String userID, User user) {
return service.getuserDetail(userID, user, repository);
}
此外,订单基于触发器是随机的。这是完整的堆栈跟踪
2016-11-12 09:16:48.963 DEBUG 9848 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/getUserInfo]
2016-11-12 09:16:48.963 DEBUG 9848 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /getUserInfo
2016-11-12 09:16:48.965 DEBUG 9848 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public com.boot.model.User com.boot.controller.ConsumerController.getUserInfo(java.lang.String,com.boot.model.User)]
2016-11-12 09:16:48.966 DEBUG 9848 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Last-Modified value for [/getUserInfo] is: -1
2016-11-12 09:16:48.968 DEBUG 9848 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing POST request for [/login]
2016-11-12 09:16:48.971 DEBUG 9848 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /login
2016-11-12 09:16:48.973 DEBUG 9848 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public java.util.ArrayList<com.boot.model.User> com.boot.controller.ConsumerController.login(java.lang.String,java.lang.String)]
2016-11-12 09:16:49.074 DEBUG 9848 --- [nio-8080-exec-3] o.s.web.cors.DefaultCorsProcessor : Skip CORS processing: request is from same origin
这是我的pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!--<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>1.4.9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId>
<version>2.11.0</version> </dependency> <dependency> <groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId> <version>2.11.0</version> </dependency> -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.7</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
答案 0 :(得分:0)
Spring映射器没有问题。这与我的HTML有关,这些按钮包含在表单标签中并且具有登录操作。我以某种方式错过了这个并且正在查看更大的图片..感谢您的所有投入