Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active August 9, 2016 09:32
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 iyengarajay/c7bfdc2a3cd917f479309a5d6bf7b0a0 to your computer and use it in GitHub Desktop.
Save iyengarajay/c7bfdc2a3cd917f479309a5d6bf7b0a0 to your computer and use it in GitHub Desktop.
package com.example;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class EmployeeRestController {
private EmployeeRepository employeeRepository;
@Autowired
public EmployeeRestController(EmployeeRepository employeeRepository) {
this.employeeRepository = employeeRepository;
}
@RequestMapping("/employees")
public List<Employee> employees() {
return employeeRepository.findAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment