I'm trying to upload an application configured with Spring and it's displaying 405 error.
Controller:
@Controller
@RequestMapping(value = "/solicitacaoDeMaterial")
public class SolicitacaoMaterialController {
@Autowired
private SolicitacaoService solicitacaoService;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<?> get() {
return new ResponseEntity<>("Solicitacão incluída com sucesso", HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<?> salvar(@RequestBody SolicitacaoVO solicitacao) {
try {
solicitacaoService.salvar(solicitacao);
return new ResponseEntity<>("Solicitacão incluída com sucesso", HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<String>("Ocorreu um erro " + e.getMessage(), HttpStatus.OK);
}
}
Mapeamento da página:
$scope.salvarDados = function () {
$scope.solicitacao.produtos = $scope.produtos;
$http({
method : "POST",
url : "solicitacaoDeMaterial",
data: $scope.solicitacao
}).then(function myChessus(response) {
console.log(response)
}, function myError(response) {
console.log(response)
});
};
Obs : I already added the base href="/formularios/"
in the head of the page.