Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Granger adamish

View GitHub Profile
@adamish
adamish / UnusedBeans.java
Created Dec 8, 2016
Unreferenced spring beans across multiple files
View UnusedBeans.java
public class UnusedBeans {
private Map<String, Node> defs = new HashMap<String, Node>();
private Set<String> refs = new HashSet<String>();
public void read() throws Exception {
String content = new String(Files.readAllBytes(Paths.get("xml.txt")));
for (String line : content.split("\n")) {
parse("../" + line.trim());
}
@adamish
adamish / XmlMerge.java
Created Jul 6, 2016
Merge 2 or more spring contexts to find common beans, output them to a common file, then remove them from original files. Take into account formatting differences
View XmlMerge.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;