public static void registerGuiceBound ( Injector injector , final JerseyEnvironment environment ) { while ( injector != null ) { for ( Key < ? > key : injector . getBindings ( ) . keySet ( ) ) { Type type = key . getTypeLiteral ( ) . getType ( ) ; if ( type instanceof Class ) { Class < ? > c = ( Class ) type ; if ( isProviderClass ( c ) ) { logger . info ( "Registering {} as a provider class" , c . getName ( ) ) ; environment . register ( c ) ; } else if ( isRootResourceClass ( c ) ) { // Jersey rejects resources that it doesn't think are acceptable // Including abstract classes and interfaces, even if there is a valid Guice binding. if ( Resource . isAcceptable ( c ) ) { logger . info ( "Registering {} as a root resource class" , c . getName ( ) ) ; environment . register ( c ) ; } else { logger . warn ( "Class {} was not registered as a resource. Bind a concrete implementation instead." , c . getName ( ) ) ; } } } } injector = injector . getParent ( ) ; } }
Registers any Guice - bound providers or root resources .