remove duplicated get method to /api/v1/users from the main file

This commit is contained in:
Mika Bomm 2024-09-01 21:43:13 +02:00
parent 4d9f0fbb0e
commit 94b3fec5e2

View file

@ -1,31 +1,14 @@
package com.mixel.docusphere; package com.mixel.docusphere;
import com.mixel.docusphere.entity.User;
import com.mixel.docusphere.repository.UserRepository;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@SpringBootApplication @SpringBootApplication
@RestController @RestController
public class DocuSphereApplication { public class DocuSphereApplication {
public DocuSphereApplication(UserRepository userRepository) {
this.userRepository = userRepository;
}
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DocuSphereApplication.class, args); SpringApplication.run(DocuSphereApplication.class, args);
} }
private final UserRepository userRepository;
@GetMapping("/api/v1/users")
public List<User> getUsers() {
return userRepository.findAll();
}
} }