Requestmethod Post Not Supported || Spring Login

Requestmethod POST not supported || Spring login

I think there is issue in this line in both method

@RequestMapping(value = "/login-success", method = {RequestMethod.POST, 
RequestMethod.GET})

You have configured both GET and POST for a rest call

Try this

 @RequestMapping(value = "/login-success", method=RequestMethod.POST)

Spring,Request method 'POST' not supported

Your user.jsp:

 <form:form action="profile/proffesional" modelAttribute="PROFESSIONAL">
---
---
</form:form>

In your controller class:

(make it as a meaning full method name..Hear i think you are insert record in DB.)

@RequestMapping(value = "proffessional", method = RequestMethod.POST)
public @ResponseBody
String proffessionalDetails(
@ModelAttribute UserProfessionalForm professionalForm,
BindingResult result, Model model) {

UserProfileVO userProfileVO = new UserProfileVO();

userProfileVO.setUser(sessionData.getUser());
userService.saveUserProfile(userProfileVO);
model.addAttribute("PROFESSIONAL", professionalForm);

return "Your Professional Details Updated";

}

Spring boot - Request method 'POST' not supported. Tried everything

Following might help.

  1. While you deploy the application, spring boot displays all the
    available services on the console. Check the POST method to create
    is being displayed or not. Check that there shouldn't be any contradiction with other services. GET/PUT/POST
  2. If there are services not deployed, try adding '/' before other services - GET, PUT, POST.
  3. Adding exception handler(link) to check the client input request to check the POJO structure.
  4. Check the URL - If any global path for app/name added with
    configuration.(link)
  5. Try to remove headers - Content-Type in the request header and post
    the request again

Following are different things that can happen. Need not to be followed in order.

EDIT:

Run the following to check whether your controller is being enabled and considered by the spring application or not.

import java.util.Arrays;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);

System.out.println("Let's inspect the beans provided by Spring Boot:");

String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}

}

Spring MVC Request method 'PATCH' not supported

I tried on a demo spring boot application and patch is working as expected.

There is one unrelated issue in your code... You are using @PathVariable("id") in updateById method without having a pathVariable placeholder in the URI.



Related Topics



Leave a reply



Submit