1
I’m having a problem with my restful service with spring. Even after enabling CORS, I can’t connect with my angular application.
@CrossOrigin
public class UsuarioController {
@Autowired
UsuarioService service;
@RequestMapping(method = RequestMethod.GET, value = "/lista_todos_usuarios", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<Usuario>> buscaTodosUsuarios() {
Collection<Usuario> usuarios = service.buscaTodosUsuarios();
return new ResponseEntity<>(usuarios, HttpStatus.OK);
}
}
Below is the message in the browser console.
Sorry for the delay (I spent a few days offline). In my case I only used the annotation @Crossorigin of spring same. However it is possible to pass parameters to free access to the service, only the origin I want. In my case, I decided to release to any source (study only).
– André Rodrigues de Sousa
Solved issue. Missing @Restcontroller annotation. hehehe
– André Rodrigues de Sousa