The following article applies to Nexus Repository 2.8+.
Visit my.sonatype.com for documentation on Nexus Repository version 2.
In old Nexus Repository 2 versions, this was done by editing web.xml.
In Nexus Repository 2.8 and greater, this has changed.
You'll need to write a Nexus Repository 2 plugin which adds a Guice module. A good example that demonstrates this is:
https://github.com/sonatype/nexus-oss/blob/nexus-2.8.x/plugins/basic/nexus-content-plugin/src/main/java/org/sonatype/nexus/content/internal/ContentModule.java