habuma / spring-in-action-6-samples

Sample code from Spring in Action 6
484 stars 339 forks source link

chapter 5 lack the User class used in the In-memory user detail service #3

Open chenqping opened 3 years ago

chenqping commented 3 years ago

@habuma

kangourouNomade commented 1 year ago

https://github.com/habuma/spring-in-action-6-samples/blob/64c50d1e1eb5485aafecef2749b0bcd1ca2edf38/ch05/taco-cloud-sfc/src/main/java/tacos/security/SecurityConfig.java

@Bean public UserDetailsService userDetailsService(UserRepository userRepo) { return username -> { User user = userRepo.findByUsername(username); if (user != null) { return user; } throw new UsernameNotFoundException( "User '" + username + "' not found"); }; }

Bad return type in lambda expression: User cannot be converted to UserDetailsService