< Spring boot

CORS

Szerző: Sallai András

Copyright © Sallai András, 2023

Licenc: CC Attribution-Share Alike 4.0 International

Web: https://szit.hu

Függőség

<dependency> <groupId>org.apache.httpcomponents.client5</groupId> <artifactId>httpclient5</artifactId> <scope>test</scope> </dependency>

Kontrollerben

@CrossOrigin @GetMapping("/employees") public @ResponseBody Iterable<Employee> index() { return empRepository.findAll(); }
@CrossOrigin("http://valahonnan.lan") @GetMapping("/employees") public @ResponseBody Iterable<Employee> index() { return empRepository.findAll(); }