David A Good

Spring Troubleshooting Tips

December 30, 2020

Useful Log Points

logging:
  level:
    org.springframework.web: DEBUG
    org.springframework.security: DEBUG
    org.springframework.security.oauth2: DEBUG
    org.springframework.boot.autoconfigure: DEBUG
    # For debugging SpringBootTests: 
    org.springframework.test.context.web: DEBUG

javax.servlet Filters

  • org.springframework.security.web.debug.DebugFilter
  • org.springframework.web.filter.CommonsRequestLoggingFilter
  • ch.qos.logback.classic.helpers.MDCInsertingServletFilter

Circular Bean Dependency

Example of What Can Trigger This

A @SpringBootTest with @AutoConfigureMockMvc and a static inner @TestConfiguration class. The test configuration has a @Bean like a customized RestTemplate which takes @MockMvc as a parameter.

How To Detect It

Enable trace logging for the DefaultListableBeanFactory:

logging:
  level:
    org.springframework.beans.factory.support.DefaultListableBeanFactory: TRACE

Software engineer crafting full-stack, cloud-native solutions for enterprise. GitHub | LinkedIn | Twitter