Debug Spring Boot issues systematically: bean errors, circular dependencies, startup failures, JPA/Hibernate problems, security misconfigurations, and property binding failures using Actuator and JVM debugging.
Ships in debug-and-refactor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert Spring Boot debugger. Follow this systematic approach to diagnose and resolve issues efficiently.
Symptoms:
Debugging Steps:
@Component, @Service, @Repository, or @Controller annotation@ComponentScan (must be in or below @SpringBootApplication class package)@Configuration classes with @Bean methods are being loaded@ConditionalOnProperty, @Profile) that might exclude the bean@QualifierQuick Fixes:
// Ensure main class is at root package
@SpringBootApplication
public class Application { ... }
// Explicit component scan if needed
@ComponentScan(basePackages = {"com.example.main", "com.example.other"})
// Check bean registration
@Autowired
private ApplicationContext context;
Arrays.stream(context.getBeanDefinitionNames()).forEach(System.out::println);
Symptoms:
Debugging Steps:
lsof -i :8080 or netstat -an | grep 8080Quick Fixes:
# Change port if in use
server.port=8081
# Enable debug startup logging
debug=true
logging.level.org.springframework=DEBUG
# Fail fast on missing properties
spring.main.allow-bean-definition-overriding=false
Symptoms:
Debugging Steps:
Quick Fixes:
// Option 1: Use @Lazy on one dependency
@Autowired
@Lazy
private ServiceB serviceB;
// Option 2: Use setter injection
private ServiceB serviceB;
@Autowired
public void setServiceB(ServiceB serviceB) {
this.serviceB = serviceB;
}
// Option 3: Refactor to event-based communication
@EventListener
public void handleEvent(CustomEvent event) { ... }
Symptoms:
Debugging Steps:
@Transactional placement (must be on public methods)Quick Fixes:
# Enable SQL debugging
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# Schema handling
spring.jpa.hibernate.ddl-auto=validate # Recommended for debugging
spring.jpa.hibernate.ddl-auto=update # Auto-update schema (dev only)
// Fix LazyInitializationException
@Transactional(readOnly = true)
public Entity getWithChildren(Long id) {
Entity e = repository.findById(id).orElseThrow();
e.getChildren().size(); // Force initialization
return e;
}
// Or use EntityGraph
@EntityGraph(attributePaths = {"children", "children.grandchildren"})
Optional<Entity> findById(Long id);
Symptoms:
Debugging Steps:
Quick Fixes:
# Enable security debugging
logging.level.org.springframework.security=DEBUG
logging.level.org.springframework.security.web.FilterChainProxy=DEBUG
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(auth -> auth
.requestMatchers("/api/public/**").permitAll()
.requestMatchers("/actuator/health").permitAll()
.anyRequest().authenticated()
)
.csrf(csrf -> csrf.disable()) // Only for APIs with token auth
.cors(Customizer.withDefaults());
return http.build();
}
}
Symptoms:
Debugging Steps:
spring.profiles.active)@ConfigurationProperties prefix matchesQuick Fixes:
// Debug property sources
@Autowired
private Environment env;
@PostConstruct
public void debugProperties() {
System.out.println("Active profiles: " + Arrays.toString(env.getActiveProfiles()));
System.out.println("Property value: " + env.getProperty("my.property"));
}
// Ensure @ConfigurationProperties is scanned
@EnableConfigurationProperties(MyProperties.class)
@SpringBootApplication
public class Application { ... }
# Add to see property resolution
logging.level.org.springframework.boot.context.properties=DEBUG
Essential for runtime diagnostics:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
# Expose all actuator endpoints (dev only)
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
Key Endpoints:
/actuator/health - Application health status/actuator/beans - All registered beans/actuator/env - Environment properties/actuator/mappings - Request mappings/actuator/configprops - Configuration properties/actuator/conditions - Auto-configuration report# Maven
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
# Gradle
./gradlew bootRun --debug-jvm
# Java directly
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar app.jar
# Docker Compose
environment:
- JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
ports:
- "5005:5005"
Create src/main/resources/logback-spring.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- Debug specific packages -->
<logger name="org.springframework.web" level="DEBUG"/>
<logger name="org.hibernate.SQL" level="DEBUG"/>
<logger name="com.yourapp" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
Features:
# Check application logs
tail -f logs/spring.log
# Check JVM status
jps -lv
jstat -gc <pid>
jstack <pid>
# Check actuator endpoints
curl localhost:8080/actuator/health
curl localhost:8080/actuator/env
curl localhost:8080/actuator/beans
// Create minimal test case
@SpringBootTest(classes = {TestConfig.class, ProblemBean.class})
class IsolatedTest {
@Autowired
private ProblemBean bean;
@Test
void reproduceIssue() {
// Minimal steps to reproduce
}
}
// Use test slices for faster isolation
@WebMvcTest(ProblemController.class)
@DataJpaTest
@JsonTest
// Add diagnostic logging
@Aspect
@Component
public class DiagnosticAspect {
private static final Logger log = LoggerFactory.getLogger(DiagnosticAspect.class);
@Around("execution(* com.yourapp.service.*.*(..))")
public Object logMethodExecution(ProceedingJoinPoint jp) throws Throwable {
log.debug("Entering: {}", jp.getSignature());
try {
Object result = jp.proceed();
log.debug("Exiting: {} with result: {}", jp.getSignature(), result);
return result;
} catch (Exception e) {
log.error("Exception in {}: {}", jp.getSignature(), e.getMessage());
throw e;
}
}
}
# Run targeted tests
./mvnw test -Dtest=ProblemTest
# Run full test suite
./mvnw verify
# Check for regressions
./mvnw test -Dtest=*IntegrationTest
# Run with debug logging
./mvnw spring-boot:run -Dspring-boot.run.arguments="--debug"
# Run with specific profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
# Skip tests and run
./mvnw spring-boot:run -DskipTests
# Generate dependency tree
./mvnw dependency:tree
# Check for dependency conflicts
./mvnw dependency:analyze
# Force update dependencies
./mvnw clean install -U
# Run with debug logging
./gradlew bootRun --args='--debug'
# Run with specific profile
./gradlew bootRun --args='--spring.profiles.active=dev'
# Show dependencies
./gradlew dependencies
# Refresh dependencies
./gradlew build --refresh-dependencies
# Check container logs
docker logs <container_name> -f
# Shell into container
docker exec -it <container_name> /bin/sh
# Check container health
docker inspect --format='{{.State.Health.Status}}' <container_name>
# View container environment
docker exec <container_name> env | grep SPRING
# Get pod logs
kubectl logs <pod-name> -f
# Get previous container logs (after crash)
kubectl logs <pod-name> --previous
# Describe pod for events
kubectl describe pod <pod-name>
# Port forward for debugging
kubectl port-forward <pod-name> 5005:5005
# Shell into pod
kubectl exec -it <pod-name> -- /bin/sh
# Connect to PostgreSQL
psql -h localhost -U user -d database
# Show running queries
SELECT * FROM pg_stat_activity WHERE state = 'active';
# Connect to MySQL
mysql -h localhost -u user -p database
# Show process list
SHOW PROCESSLIST;
# List Java processes
jps -lv
# Thread dump
jstack <pid> > thread_dump.txt
# Heap dump
jmap -dump:format=b,file=heap.hprof <pid>
# GC stats
jstat -gcutil <pid> 1000
# JVM flags
jinfo -flags <pid>
<!-- Add Micrometer Tracing -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
# Zipkin configuration
management.tracing.sampling.probability=1.0
management.zipkin.tracing.endpoint=http://zipkin:9411/api/v2/spans
@Component
public class CorrelationIdFilter extends OncePerRequestFilter {
private static final String CORRELATION_ID = "X-Correlation-ID";
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) {
String correlationId = request.getHeader(CORRELATION_ID);
if (correlationId == null) {
correlationId = UUID.randomUUID().toString();
}
MDC.put("correlationId", correlationId);
response.setHeader(CORRELATION_ID, correlationId);
try {
chain.doFilter(request, response);
} finally {
MDC.remove("correlationId");
}
}
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/debug-and-refactor:debug:spring-bootfrom debug-and-refactor
npx claudepluginhub snakeo/claude-debug-and-refactor-skills-plugin --plugin debug-and-refactor45 skills in this plugin
/debug:angularDebug Angular applications systematically with expert-level diagnostic techniques. This skill provides comprehensive guidance for troubleshooting dependency injection errors, change detection issues (NG0100), RxJS subscription leaks, lazy loading failures, zone.js problems, and common Angular runtime errors. Includes structured four-phase debugging methodology, Angular DevTools usage, console debugging utilities (ng.probe), and performance profiling strategies for modern Angular applications./debug:djangoDebug Django web applications with systematic diagnostic approaches. This skill covers troubleshooting Django-specific errors including TemplateDoesNotExist, ImproperlyConfigured, IntegrityError, migration conflicts, CSRF failures, N+1 query problems, and circular imports. Includes Django Debug Toolbar setup, ORM query logging, pdb/ipdb usage, shell_plus debugging, and comprehensive logging configuration. Provides four-phase methodology for root cause analysis and regression prevention.Other plugins' skills for the same job
/debug:dockerDebug Docker containers, images, and infrastructure with systematic diagnostic techniques. This skill provides comprehensive guidance for troubleshooting container exit codes, OOM kills, image build failures, networking issues, volume mount problems, and permission errors. Covers four-phase debugging methodology from quick assessment to deep analysis, essential Docker commands, debug container techniques for minimal images, and platform-specific troubleshooting for Windows, Mac, and Linux.