intermediateManaging Users: UserDetailsService & UserDetailsManager

Why would a team write a custom UserDetailsService instead of using JdbcUserDetailsManager?

JdbcUserDetailsManager expects a fixed default schema (users/authorities tables) that rarely matches a real business domain model. A custom UserDetailsService lets you map your own JPA entity (with whatever additional business fields you need) into Spring Security's UserDetails contract, giving full control over the query and mapping logic.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What happens if isEnabled() returns false for a user during login?← Back to all Spring Security questions