so this is done in two steps
1/ at compilation time when a template is injected and this template has a path that is not located inside the application templates then this template is considered as managed, whether it actually exists or not (see TemplateContainerMetaModel#add method). This template is declared in the templates to load at runtime as “needed” by the application in the JSON config of the application, for instance:
{
"controller":{
"controllers":["plugin.template.external.A_"],
"default":null,
"escapeXML":null
},
"template":{
"package":"plugin.template.external.templates",
"templates":["plugin.template.simple.templates.index"]
}
}
In this case the template is plugin.template.simple.templates.index however the template package is plugin.template.external.templates.
2/ at runtime the template bean is loaded from the classloader in the PluginTemplate class when it describes the bean involved in the IOC in the TemplatesDescriptor class.
So for external templates, they can be injected however the actual code does not check their existence at compilation time. Perhaps it could be checked in the TemplateContainerMetaModel#add and if the template is absent then a warning or a failure is issued. I would rather do a warning than a failure at a warning provides more flexibility and a failure would not prevent anyway the template to be here at runtime since the external template would not be packaged along with the application.