Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created March 29, 2024 01:15
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 httpmurilo/e7f29bfb97a7284b8ed1cc6fbec000be to your computer and use it in GitHub Desktop.
Save httpmurilo/e7f29bfb97a7284b8ed1cc6fbec000be to your computer and use it in GitHub Desktop.
UserController.java
@RestController
@RequestMapping("/api/user")
public class UserController {
@Autowired
private IUserRepository repository;
@GetMapping(value = "/search")
public ResponseEntity<User> findByName(@RequestParam String name) {
var user = repository.getUserByName(name);
return ResponseEntity.ok((User) user);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment