Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created December 8, 2021 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hkazanci93/a8e7e3b6a16a2b7296c0fe37dc6ace0a to your computer and use it in GitHub Desktop.
Save Hkazanci93/a8e7e3b6a16a2b7296c0fe37dc6ace0a to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/api/companies")
public class CompanyController {
@Autowired
CompanyRepository repository;
@GetMapping("name/{name}")
Optional<Company> byName(@PathVariable("name") String name) {
return repository.findOneByName(name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment