28 lines
659 B
Java
28 lines
659 B
Java
|
package net.risesoft.demo.controller;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import net.risesoft.demo.entity.User;
|
||
|
import net.risesoft.demo.repository.UserRepository;
|
||
|
|
||
|
@RestController
|
||
|
@RequestMapping("/api/users")
|
||
|
public class UserController {
|
||
|
|
||
|
private final UserRepository userRepository;
|
||
|
|
||
|
public UserController(UserRepository userRepository) {
|
||
|
super();
|
||
|
this.userRepository = userRepository;
|
||
|
}
|
||
|
|
||
|
@GetMapping
|
||
|
public List<User> findAll(){
|
||
|
return userRepository.findAll();
|
||
|
}
|
||
|
}
|