There was an unexpected error (type=Method Not Allowed, status=405). Request method ‘GET’ not supported with spring boot Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of There was an unexpected error (type=Method Not Allowed, status=405). Request method ‘GET’ not supported with spring boot without wasting too much if your time.

The question is published on by Tutorial Guruji team.

package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.repository.CheckListRepository;
import com.example.demo.service.CheckListService;

@CrossOrigin
@RequestMapping("action/")
@RestController
public class ActionController {

    @Autowired
    CheckListRepository clr;

    @Autowired
    CheckListService cls;

    @DeleteMapping(path = "{deleteId}")
    public void deleteAction(@PathVariable Integer deleteId) {

        clr.deletebyListNo(deleteId);

    }

}

package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.repository.CheckListRepository;
import com.example.demo.service.CheckListService;

@CrossOrigin
@RequestMapping("action/")
@RestController
public class ActionController {

    @Autowired
    CheckListRepository clr;

    @Autowired
    CheckListService cls;

    @RequestMapping(path = "{deleteId}")
    public void deleteAction(@PathVariable Integer deleteId) {

        clr.deletebyListNo(deleteId);

    }

}

Source: stackoverflow.com
We are here to answer your question about There was an unexpected error (type=Method Not Allowed, status=405). Request method ‘GET’ not supported with spring boot - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji