Я хотел бы знать, как работает Velocity Template без инициализации.
Инициализация отсутствует: как показано ниже
Velocity.init();
OR
VelocityEngine velocity = new VelocityEngine();
velocity.init();
Код, работающий без init():
System.out.println("Hello World from Java Source");
VelocityContext context = new VelocityContext();
context.put( "name", new String("Velocity") );
Template template = Velocity.getTemplate("default-template.vm");
StringWriter sw = new StringWriter();
template.merge( context, sw );
System.out.println(sw.toString());
Вывод:
Hello World from Java Source
Hello World from Velocity Template