Reputation: 15
//added image
@RestController
public class EmployeeController {
@Autowired
private EmployeeService es;
@RequestMapping(value="/{id}", method=RequestMethod.GET)
public Employee getEmployeeByID(@PathVariable Long id)
{
return es.getEmployeeByID(id)
.orElseThrow(() -> new ResourceNotFoundException("User not found with id :" + id));
}}
Upvotes: 0
Views: 429
Reputation: 1
You are getting error message in Eclipse because your Java library in not in project build path. You can configure is as following.
Right-click on project and then click on properties.
Click on Java Build Path.
Click on Libraries and then click on classpath.
Click on Add Library and then select your JDK.
Click on Apply and Close.
Clean and build the project from Project menu on the top of the Eclipse.
Upvotes: 0