@Configuration is Spring’s annotation to signal that this class is a source of bean definitions rather than actual application code. Spring Boot will detect it through its component scanning and automatically add all its bean definitions to the application context.
UserDetailsService is Spring Security’s interface for defining a source of users. This bean definition, marked with @Bean, creates InMemoryUserDetailsManager.
Using InMemoryUserDetailsManager, we can then create a couple of users. Each user has a username, a password, and a role. This code fragment also uses the withDefaultPasswordEncoder() method to avoid encoding the password.