Skip to content

Commit b9a6baf

Browse files
vjkoskelaBrandonArp
authored andcommitted
Use Guice to Instantiate Supplemental Routes (#54)
* Use Guice to Instantiate Supplemental Routes * Update Main.java
1 parent c2f0efb commit b9a6baf

File tree

1 file changed

+1
-9
lines changed
  • src/main/java/com/arpnetworking/metrics/mad

1 file changed

+1
-9
lines changed

src/main/java/com/arpnetworking/metrics/mad/Main.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,7 @@ private void launchActors(final Injector injector) {
220220
// Load supplemental routes
221221
final List<SupplementalRoutes> supplementalHttpRoutes = new ArrayList<>();
222222
_configuration.getSupplementalHttpRoutesClass().ifPresent(clazz -> {
223-
try {
224-
supplementalHttpRoutes.add(clazz.newInstance());
225-
} catch (final InstantiationException | IllegalAccessException e) {
226-
LOGGER.warn()
227-
.setMessage("Failed to instantiate supplemental http routes")
228-
.addData("supplementalHttpRoutesClass", clazz)
229-
.setThrowable(e)
230-
.log();
231-
}
223+
supplementalHttpRoutes.add(injector.getInstance(clazz));
232224
});
233225

234226
// Create and bind Http server

0 commit comments

Comments
 (0)