title: I am getting 403 forbidden using spring boot 3.0M4 and java 17
body: <pre><code>  package org.tnc.application.security.config;
      
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.context.annotation.Bean;
      import org.springframework.context.annotation.Configuration;
      import org.springframework.http.HttpMethod;
      import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
      import org.springframework.security.config.annotation.web.builders.HttpSecurity;
      import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
      import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
      import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
      import org.springframework.security.crypto.password.PasswordEncoder;
      import org.tnc.application.security.serviceimpl.UserDetailsServiceImpl;
      
      @SuppressWarnings(&quot;deprecation&quot;)
    //@Configuration
      @EnableWebSecurity
      public class WebSecurityConfig extends WebSecurityConfigurerAdapter {   
          @Autowired
          UserDetailsServiceImpl userDetailsServiceImpl;  
          @Override
          protected void configure(AuthenticationManagerBuilder auth) throws Exception {
              auth.userDetailsService(userDetailsServiceImpl);
          }
          @Override
          protected void configure(HttpSecurity http) throws Exception {
              http.httpBasic();
              http.authorizeRequests().mvcMatchers(HttpMethod.GET,&quot;/hello&quot;).hasAnyRole(&quot;USER&quot;,&quot;ADMIN&quot;);
              http.csrf().disable();
          }
          @Bean
          public PasswordEncoder passwordEncoder() {
              return new BCryptPasswordEncoder();
          }
      
      }
  
  </code></pre>
  <p>after providing the authentication details in basic auth section I am getting the error. The user details are fetched form database and pass through UserDetailsServiceImpl. I am attaching both the classes.</p>
  <pre><code>package org.tnc.application.security.serviceimpl;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.security.core.userdetails.UserDetails;
  import org.springframework.security.core.userdetails.UserDetailsService;
  import org.springframework.security.core.userdetails.UsernameNotFoundException;
  import org.springframework.stereotype.Service;
  import org.tnc.application.security.model.User;
  import org.tnc.application.security.service.UserService;
  
  @Service
  public class UserDetailsServiceImpl implements UserDetailsService {
      
      @Autowired
      private UserService userService;
  
      @Override
      public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
          User user = userService.findByEmail(username);      
          if(user == null)
              throw new UsernameNotFoundException(&quot;User not present&quot;);
          System.out.println(&quot;name of the user &quot;+user.getPassword());
          return new org.springframework.security.core.userdetails.User(user.getEmail(), user.getPassword(), user.getRoles());
      }
  
  }
  </code></pre>
  <p>UserDetailsServiceImpl is also attached which will validate and parse the user details.</p>