Skip to content

Instantly share code, notes, and snippets.

@compwron
Created October 10, 2012 05:03
Show Gist options
  • Save compwron/3863263 to your computer and use it in GitHub Desktop.
Save compwron/3863263 to your computer and use it in GitHub Desktop.
finder for dead spring beans in a java codebase; if the usage is 0 or 1, it's probably dead.
`grep "bean id=" resources/*.xml`.split("\n").map{ |raw_bean|
raw_bean.split('"')
}.map {|bean_pieces|
bean_pieces[1]
}.map {|bean_name|
num = `find ./ -iname "*.java" -exec grep #{bean_name} '{}' \\; | wc -l`
puts "#{bean_name} #{num}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment