I've found a regression that is caused by #21060, Everything works with version 2.3.0 and it no longer works with version 2.3.1.

If you define the nullValue compiler option in mustache, it no longer works and throw an exception telling that the field is not found:

Caused by: com.samskivert.mustache.MustacheException$Context: No method or field with name 'model.id' on line 7`
        @Bean
    public Mustache.Compiler mustacheCompiler(TemplateLoader mustacheTemplateLoader,
                                                                                        Environment environment) {
        return Mustache.compiler()
                        .nullValue("")
                        .withLoader(mustacheTemplateLoader)
                        .withCollector(collector(environment));
    }

    private Mustache.Collector collector(Environment environment) {
        MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector();
        collector.setEnvironment(environment);
        return collector;
    }

I've made a simple project with a test case to demonstrate it. It can be found here. https://github.com/ebussieres/regression-21060

Comment From: ebussieres

I think that i've found a workaround. If I use the defaultValue compiler option instead of nullValue, it seems to work.

return Mustache.compiler()
           .defaultValue("")
           .withLoader(mustacheTemplateLoader)
           .withCollector(collector(environment));

Still, I think that something has been broken since the javadoc of the nullValue method specifies this :

   /** Returns a compiler that will use the given value for any variable that resolves to
      * null, but will still raise an exception for variables for which an accessor cannot be
      * found. This is like {@link #defaultValue} except that it differentiates between missing
      * accessors, and accessors that exist but return null.
      * <ul>
      * <li>In the case of a Java object being used as a context, if no field or method can be
      * found for a variable, an exception will be raised.</li>
      * <li>In the case of a {@link Map} being used as a context, if the map does not contain
      * a mapping for a variable, an exception will be raised. If the map contains a mapping
      * which maps to {@code null}, then {@code nullValue} is used.</li>
      * </ul> */

In my case, the accessor does exist, so it shouldn't throw an error.