code: public ThymeLeafTemplateImplementation addTemplate(Bundle bundle, URL templateURL) {
          ThymeLeafTemplateImplementation template = getTemplateByURL(templateURL);
          if (template != null) {
              // Already existing.
              return template;
          }
          synchronized (this) {
              // need to be synchronized because of the access to engine.
              template = new ThymeLeafTemplateImplementation(engine, templateURL,
                      router, assets, bundle);
          }
          ServiceRegistration<Template> reg = context.registerService(Template.class, template,
                  template.getServiceProperties());
          registrations.put(template, reg);
          LOGGER.debug("Thymeleaf template added for {}", templateURL.toExternalForm());
          return template;
      }
docs: Adds a template form the given url.
  
  @param bundle the bundle containing the template, use system bundle for external templates.
  @param templateURL the url
  @return the added template. IF the given url is already used by another template, return this other template.