in doc-architect/doc-architect-core/src/main/java/com/docarchitect/core/scanner/impl/java/JavaHttpClientScanner.java [159:205]
protected boolean shouldScanFile(Path file) {
try {
String content = readFileContent(file);
// Check for Feign imports and annotations
boolean hasFeignPatterns =
content.contains("FeignClient") ||
content.contains("org.springframework.cloud.openfeign");
// Check for RestTemplate usage
boolean hasRestTemplatePatterns =
content.contains("RestTemplate") ||
content.contains("getForObject") ||
content.contains("postForObject") ||
content.contains("exchange(");
// Check for WebClient usage
boolean hasWebClientPatterns =
content.contains("WebClient") ||
content.contains("org.springframework.web.reactive.function.client");
// Check for HTTP URLs (basic heuristic)
boolean hasHttpUrls =
content.contains("http://") || content.contains("https://");
boolean hasHttpClientPatterns =
hasFeignPatterns || hasRestTemplatePatterns || hasWebClientPatterns;
if (hasHttpClientPatterns) {
log.debug("Including file with HTTP client patterns: {} (feign={}, restTemplate={}, webClient={})",
file.getFileName(), hasFeignPatterns, hasRestTemplatePatterns, hasWebClientPatterns);
return true;
}
// If no specific patterns but has HTTP URLs, still scan (could be string templates)
if (hasHttpUrls) {
log.trace("Including file with HTTP URLs: {}", file.getFileName());
return true;
}
log.trace("Skipping file without HTTP client patterns: {}", file.getFileName());
return false;
} catch (IOException e) {
log.debug("Failed to read file for pre-filtering: {}", file);
return false;
}
}