title: Resolved [project.chts.springboot.exception.UserNotFoundException: Invalid email or password !, Try again.]
body: <p><strong>Controller</strong></p>
  <pre><code> @Controller
   public class UserListController {
  
          @PostMapping(&quot;/login&quot;)
          public @ResponseBody ResponseEntity&lt;?&gt; signIn(@RequestBody UserList 
              userlist) throws UserNotFoundException{
              {
                   UserList user = 
                   userListService.findUserByEmailAndPassword(userlist);
                  if (user == null)
                      
                      return new ResponseEntity&lt;&gt;(&quot;User not found!&quot;, 
                        HttpStatus.NOT_FOUND);
                  
                  return ResponseEntity.ok(user);
                      
              }
          
          }
  }
  </code></pre>
  <p><strong>Service</strong></p>
  <pre><code>@Service
  public class UserListService {
  
      // check mail and pass
      public UserList findUserByEmailAndPassword(UserList 
          userlist)throws UserNotFoundException {
          try {
              UserList user = 
              userListRepository.findByEmail(userlist.getEmail());
              String rawPassword = userlist.getPassword();
              if (user != null &amp;&amp; 
                  userlist.getEmail().equals(user.getEmail())
                      &amp;&amp; passwordEncoder.matches(rawPassword, 
                        user.getPassword())) {
                  UserList Result = user;
                  return Result;
              }
              throw new UserNotFoundException(&quot;Invalid email or password !, Try again.&quot;);
          } catch (Exception e) {
              throw new UserNotFoundException(e.getMessage());
          }
      }   
  }
  </code></pre>
  <p><strong>Repository</strong></p>
  <pre><code>@Repository
  public interface UserListRepository extends JpaRepository&lt;UserList, 
          Integer&gt; {
         UserList findByEmail(String email);
  }
  </code></pre>
  <p><strong>Confuguration File</strong></p>
  <pre><code>@Configuration
  //to indicate there are one or more bean methods  for process by spring container
  public class SecurityConfig {
       @Bean//it produces bean to get managed by spring container
       public PasswordEncoder passwordEncoder() {
            // PasswordEncoder service interface to encode passwords by BCryptPasswordEncoder
            PasswordEncoder encoder = new BCryptPasswordEncoder();
            return encoder;
       }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/bNOF1.png" rel="nofollow noreferrer">enter image description here</a>}
  Postman error</p>