code: public static Encoder lookupEncoder(GrailsApplication grailsApplication, String codecName) {
          ApplicationContext ctx = grailsApplication != null ? grailsApplication.getMainContext() : null;
          if(ctx != null) {
              try {
                  CodecLookup codecLookup = ctx.getBean("codecLookup", CodecLookup.class);
                  return codecLookup.lookupEncoder(codecName);
              } catch (NoSuchBeanDefinitionException e) {
                  // ignore missing codecLookup bean in tests
                  log.debug("codecLookup bean is missing from test context.", e);
              }
          }
          return null;
      }
docs: Lookup encoder.
  
  @param grailsApplication the grailsApplication instance
  @param codecName the codec name
  @return the encoder instance