This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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