protected Container findContainer ( ContainerContext ctx , StringBuilder dump ) { Container container = null ; // 1. Custom container class String containerClassName = ctx . getServletContext ( ) . getInitParameter ( Container . CONTEXT_PARAM_CONTAINER_CLASS ) ; if ( containerClassName != null ) { try { Class < Container > containerClass = Reflections . classForName ( resourceLoader , containerClassName ) ; container = SecurityActions . newInstance ( containerClass ) ; WeldServletLogger . LOG . containerDetectionSkipped ( containerClassName ) ; } catch ( Exception e ) { WeldServletLogger . LOG . unableToInstantiateCustomContainerClass ( containerClassName ) ; WeldServletLogger . LOG . catchingDebug ( e ) ; } } if ( container == null ) { // 2. Service providers Iterable < Container > extContainers = ServiceLoader . load ( Container . class , getClass ( ) . getClassLoader ( ) ) ; container = checkContainers ( ctx , dump , extContainers ) ; if ( container == null ) { // 3. Built-in containers in predefined order container = checkContainers ( ctx , dump , Arrays . asList ( TomcatContainer . INSTANCE , JettyContainer . INSTANCE , UndertowContainer . INSTANCE , GwtDevHostedModeContainer . INSTANCE ) ) ; } } return container ; }
Find container env .