spring-mvc

WEB-INF not included in WebApp using SpringBoot, Spring-MVC and Maven

廉价感情. 提交于 2021-02-20 09:09:51
问题 I have a webapp using Spring-MVC built with Maven. When I generate the JAR file the app start just fine. The controller is execute but when I reach this part: @RequestMapping(value = "/test-block", method = RequestMethod.GET) public ModelAndView block(Model model) { return new ModelAndView("templates/test-block"); } I get this error: There was an unexpected error (type=Not Found, status=404). /WEB-INF/templates/test-block.jsp Note that debugging or running in the IDE works fine. My folder:

WEB-INF not included in WebApp using SpringBoot, Spring-MVC and Maven

一笑奈何 提交于 2021-02-20 09:09:34
问题 I have a webapp using Spring-MVC built with Maven. When I generate the JAR file the app start just fine. The controller is execute but when I reach this part: @RequestMapping(value = "/test-block", method = RequestMethod.GET) public ModelAndView block(Model model) { return new ModelAndView("templates/test-block"); } I get this error: There was an unexpected error (type=Not Found, status=404). /WEB-INF/templates/test-block.jsp Note that debugging or running in the IDE works fine. My folder:

WEB-INF not included in WebApp using SpringBoot, Spring-MVC and Maven

别来无恙 提交于 2021-02-20 09:08:45
问题 I have a webapp using Spring-MVC built with Maven. When I generate the JAR file the app start just fine. The controller is execute but when I reach this part: @RequestMapping(value = "/test-block", method = RequestMethod.GET) public ModelAndView block(Model model) { return new ModelAndView("templates/test-block"); } I get this error: There was an unexpected error (type=Not Found, status=404). /WEB-INF/templates/test-block.jsp Note that debugging or running in the IDE works fine. My folder:

WEB-INF not included in WebApp using SpringBoot, Spring-MVC and Maven

牧云@^-^@ 提交于 2021-02-20 09:06:56
问题 I have a webapp using Spring-MVC built with Maven. When I generate the JAR file the app start just fine. The controller is execute but when I reach this part: @RequestMapping(value = "/test-block", method = RequestMethod.GET) public ModelAndView block(Model model) { return new ModelAndView("templates/test-block"); } I get this error: There was an unexpected error (type=Not Found, status=404). /WEB-INF/templates/test-block.jsp Note that debugging or running in the IDE works fine. My folder:

WEB-INF not included in WebApp using SpringBoot, Spring-MVC and Maven

谁说我不能喝 提交于 2021-02-20 09:05:26
问题 I have a webapp using Spring-MVC built with Maven. When I generate the JAR file the app start just fine. The controller is execute but when I reach this part: @RequestMapping(value = "/test-block", method = RequestMethod.GET) public ModelAndView block(Model model) { return new ModelAndView("templates/test-block"); } I get this error: There was an unexpected error (type=Not Found, status=404). /WEB-INF/templates/test-block.jsp Note that debugging or running in the IDE works fine. My folder:

How to perform my own authentication (checking username and password typed by the user)

别来无恙 提交于 2021-02-20 04:35:05
问题 I implemented the UserDetailsService interface and override the loadUserByUsername method. I thought that, inside loadUserByUsername , I could get username and password, to check if they match username and password on the DB. But I can't understand how to get the password typed by the user, provided that it is possibile. Probably, I'm implementing the wrong interface. Is UserDetailsService enough to do what I want to or I have to implement or extend something else? 回答1: The UserDetailsService

Spring Security custom RememberMeAuthenticationFilter not getting fired

ぃ、小莉子 提交于 2021-02-20 04:18:50
问题 I have implemented 'Remember Me' functionality in my Spring MVC application using Spring Security 3.1 My security-context.xml looks like this : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www

Request Mapping returning error 404

蓝咒 提交于 2021-02-19 08:58:08
问题 This is my controller that maps a request to this url http://localhost:8080/SpringMVCJSON/rest/kfc/brands contoller file @Controller @RequestMapping("/kfc/brands") public class JSONController { @RequestMapping(value = "{name}", method = RequestMethod.GET) public @ResponseBody Shop getShopInJSON(@PathVariable String name) { Shop shop = new Shop(); shop.setName(name); shop.setStaffName(new String[] { "name1", "name2" }); return shop; } this is the web.xml with the servlet request that

Spring Validator and BindingResult - How to set different HttpStatus Codes?

北城以北 提交于 2021-02-19 07:58:12
问题 Dear Spring Community, I am building my project using Spring. In my API layer, I am leveraging the Validator interface in order to do some custom validation and set an error. @Override public void validate(Object obj, Errors e) { SignUpRequest signUpRequest = (SignUpRequest) obj; User user = userService.getUserByEmail(signUpRequest.getEmail()); if (user != null) { e.rejectValue("user", ErrorCodes.USER_EXIST, "user already exist"); } } Now, in my API signature, since I am using the

How to debug a Spring Boot application in Spring Tool Suite

落爺英雄遲暮 提交于 2021-02-19 04:35:08
问题 I'd like to debug a simple Spring Boot application in Spring Tool Suite. It is a simple restful web service. I wanted to debug the controller and service class with embedded tomcat server. Found this post how to debug Spring MVC application on Spring Source Tool Suite. I followed the steps: Select Window-->Show View--> Servers . Right Click on server in the Servers panel, select " Debug ". Add breakpoints in your code Then right click on application, Select Debug As --> Debug on Server After