Bird
0
0

Given this Spring Security config snippet, what will be the access behavior for the /actuator/health endpoint?

medium📝 component behavior Q4 of 15
Spring Boot - Actuator
Given this Spring Security config snippet, what will be the access behavior for the /actuator/health endpoint?
http
  .authorizeHttpRequests()
  .requestMatchers("/actuator/health").permitAll()
  .requestMatchers("/actuator/**").authenticated()
A/actuator/health requires authentication
BAll actuator endpoints require ADMIN role
C/actuator/health is publicly accessible
DAll actuator endpoints are publicly accessible
Step-by-Step Solution
Solution:
  1. Step 1: Analyze matcher order and specificity

    The specific matcher for /actuator/health is set to permitAll(), so it is public.
  2. Step 2: Understand fallback matcher

    Other actuator endpoints require authentication, but health is excluded.
  3. Final Answer:

    /actuator/health is publicly accessible -> Option C
  4. Quick Check:

    Specific permitAll matcher overrides general authenticated matcher [OK]
Quick Trick: Specific matchers override general ones in Spring Security [OK]
Common Mistakes:
  • Assuming general matcher applies before specific
  • Thinking health requires authentication
  • Confusing permitAll with authenticated

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes