getting error not working in springboot.

getting error not working in springboot.

@RequestMapping(value = "/", method = RequestMethod.GET)

@RequestMapping(value = "/", method = RequestMethod.GET)


public ResponseEntity<List<User>> getAllUser(@RequestBody Map<String, String> payload)


String username = payload.get("username");

String password = payload.get("password");

User user = repository.findByUsername(username);

if (user != null && user.getPassword().equals(password))


Map<String,List <String>> headers=new HashMap<String,List< String>>();

while (repository.findAll()) {

String key =;

return new ResponseEntity<List<User>>(List<User>>,HttpStatus.OK);


return new ResponseEntity<List<User>>( HttpStatus.UNAUTHORIZED);


this is the code i am not getting how to put authentication so that whenever one user type his username and password which i am having in my database mongodb if the information is valid he can access other rest apis otherwise it should throw invalid authentication.


Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Java Core (2020) | Java for beginners | Brush up your Java Skills | Get Hired

In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...

Java Multithreading Example | Multithreading in Java

Java Multithreading Tutorial With Example | Multithreading in Java. Multithreading is a process of executing multiple threads simultaneously.

Java File Class Tutorial | File Class in Java Example

Java File class represents the path of directories and files. It provides the methods for renaming, deleting, and obtaining the properties of file or directory.

Java Hashmap Example | HashMap in Java

Java HashMap is the part of Collections since JDK1.2. Java HashMap provides the underlying implementation of the Map interface of Java.