@ SuppressFBWarnings ( "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" ) public void initServiceRegistryIfNecessary ( ) { val size = this . serviceRegistry . size ( ) ; LOGGER . trace ( "Service registry contains [{}] service definition(s)" , size ) ; LOGGER . warn ( "Service registry [{}] will be auto-initialized from JSON service definitions. " + "This behavior is only useful for testing purposes and MAY NOT be appropriate for production. " + "Consider turning off this behavior via the setting [cas.serviceRegistry.initFromJson=false] " + "and explicitly register definitions in the services registry." , this . serviceRegistry . getName ( ) ) ; val servicesLoaded = this . jsonServiceRegistry . load ( ) ; LOGGER . debug ( "Loaded JSON services are [{}]" , servicesLoaded . stream ( ) . map ( RegisteredService :: getName ) . collect ( Collectors . joining ( "," ) ) ) ; servicesLoaded . forEach ( r -> { if ( ! findExistingMatchForService ( r ) ) { LOGGER . debug ( "Initializing service registry with the [{}] JSON service definition..." , r . getName ( ) ) ; this . serviceRegistry . save ( r ) ; } } ) ; this . servicesManager . load ( ) ; LOGGER . info ( "Service registry [{}] contains [{}] service definitions" , this . serviceRegistry . getName ( ) , this . servicesManager . count ( ) ) ; }
Init service registry if necessary .