Performing an ajax request
function buscarDisciplina(){
var codigoDisciplina = String($("#codigo").val());
$.ajax({
url: urlApplication+"/grade-curricular/buscar-disciplina/"+codigoDisciplina,
type: 'GET',
data: codigoDisciplina,
dataType: 'JSON',
success: function(response) {
$("#disciplina").val(response);
}
});
}
Which calls the controller
@PreAuthorize("hasAuthority('PERM_GRADE_CURRICULAR_CADASTRAR')")
@RequestMapping(value = "/buscar-disciplina/{codigoDisciplina}")
public Disciplina bucarDisciplina(@PathVariable String codigoDisciplina) {
return disciplinaService.findByCodigo(codigoDisciplina);
}
Service
public Disciplina findByCodigo(String codigo){
return disciplinaRepository.findByCodigo(codigo);
}
Repository
public Disciplina findByCodigo(String codigo); //uso JpaRepository<Disciplina, Long>
Entity
@Size(max = 10)
@NotEmpty
@Column(name = "codigo")
private String codigo;
But when you send the requisition
It gives the error of the image above ... I have no idea what can be ....