As for using it with New Relic, this is the first I've heard of it (I'll see if Daniel knows a bit more - it's more likely he's been in touch with them if they've contacted us at all). Looking at that documentation page, I'm guessing the trouble with getting their timing code into Thymeleaf templates is the way they want their code inserted into pages; all their examples are using 'write arbitrary strings into an HTML page' methods as per the various view technologies they've shown, whereas with Thymeleaf you mostly need well-formed XML which also includes a lot of escaping rules around inline scripts.
So there's likely some kind of clash between the scripts they want to insert, and the scripts our XML output engine will allow.
This is just a guess based on that page - I've not used New Relic, nor do I know what their timing code looks like. If I knew a little more about the resulting string they're trying to output, I might be able to offer some workarounds.
I definitely know New Relic, but unfortunately I'm not a user myself and never had the opportunity to test it on a thymeleaf-based site.
Not sure, but I think the check you're doing ends-up trying to load the NewRelic class, which will fail if the NewRelic libraries/JAR isn't in the classpath. To do dynamic lookups of that sort, you usually have to do a query using the classloader, and then handle the failure case with a catch...