title: Spring Java Config and Thymeleaf - Dandelion Datatables config
body: <p>Attempting to get pagination on datatables using Thymeleaf and Dandelion. According to the docs I need to update a few things:</p>
  
  <p>web.xml (javaconfig attempt further down)</p>
  
  <pre><code>&lt;!-- Dandelion filter definition and mapping --&gt;
  &lt;filter&gt;
     &lt;filter-name&gt;dandelionFilter&lt;/filter-name&gt;
     &lt;filter-class&gt;com.github.dandelion.core.web.DandelionFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
     &lt;filter-name&gt;dandelionFilter&lt;/filter-name&gt;
     &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  &lt;!-- Dandelion servlet definition and mapping --&gt;
  &lt;servlet&gt;
     &lt;servlet-name&gt;dandelionServlet&lt;/servlet-name&gt;
     &lt;servlet-class&gt;com.github.dandelion.core.web.DandelionServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
     &lt;servlet-name&gt;dandelionServlet&lt;/servlet-name&gt;
     &lt;url-pattern&gt;/dandelion-assets/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>SpringTemplateEngine @Bean (skipped as I already have the Thymeleaf template Engine)</p>
  
  <pre><code>&lt;bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine"&gt;
     &lt;property name="templateResolver" ref="templateResolver" /&gt;
     &lt;property name="additionalDialects"&gt;
        &lt;set&gt;
           &lt;bean class="com.github.dandelion.datatables.thymeleaf.dialect.DataTablesDialect" /&gt;
        &lt;/set&gt;
     &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>My knowledge of Spring is still extremely shaky but I have to replace the web.xml components (least I think I can do it this way):</p>
  
  <pre><code>public class Initializer extends
          AbstractAnnotationConfigDispatcherServletInitializer...
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          logger.debug("Entering getServletConfigClasses()");
          return new Class&lt;?&gt;[] { ThymeleafConfig.class, WebAppConfig.class, DandelionServlet.class };
      } 
  
      @Override
      protected Filter[] getServletFilters() {
          return new Filter[] { new DandelionFilter(),
                  new DelegatingFilterProxy("springSecurityFilterChain") };
      }
  </code></pre>
  
  <p>My ThymeleafConfig:</p>
  
  <pre><code>@Bean
  public SpringTemplateEngine templateEngine() {
  SpringTemplateEngine templateEngine = new SpringTemplateEngine();
  templateEngine.setTemplateResolver(templateResolver());
  templateEngine.addDialect(dataTablesDialect());
  return templateEngine;
  }
  
  @Bean
  public ThymeleafViewResolver thymeleafViewResolver() {
  ThymeleafViewResolver resolver = new ThymeleafViewResolver();
  resolver.setTemplateEngine(templateEngine());
  return resolver;
  }
  
  @Bean
  public DataTablesDialect dataTablesDialect() {
  return new DataTablesDialect();
  }
  </code></pre>
  
  <p>My security settings:</p>
  
  <pre><code>.antMatchers("/dandelion-assets/**").permitAll()
  .antMatchers("/datatablesController/**").permitAll()
  </code></pre>
  
  <p>I get the following in my logs after both dialects load:</p>
  
  <pre><code>[THYMELEAF] TEMPLATE ENGINE CONFIGURED OK
  INFO org.thymeleaf.TemplateEngine - [THYMELEAF] TEMPLATE ENGINE INITIALIZED
  </code></pre>
  
  <p>When the page loads:</p>
  
  <pre><code>DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - No custom configuration. Using default one.
  DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - Resolving groups for the locale en_US...
  DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - 1 groups declared [global].
  DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - Resolving configurations for the locale en_US...
  DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - Group 'global' initialized with 0 properties
  DEBUG com.github.dandelion.datatables.core.configuration.StandardConfigurationLoader - 1 group(s) resolved [global] for the locale en_US
  DEBUG com.github.dandelion.datatables.thymeleaf.processor.el.TableFinalizerElProcessor - No configuration to apply, i.e. no 'dt:conf' has been found in the current template.
  DEBUG com.github.dandelion.datatables.core.generator.configuration.DatatablesGenerator - Generating DataTables configuration ..
  DEBUG com.github.dandelion.datatables.core.generator.configuration.DatatablesGenerator - DataTables configuration generated
  DEBUG com.github.dandelion.datatables.core.generator.WebResourceGenerator - Loading extensions...
  DEBUG com.github.dandelion.datatables.core.extension.ExtensionLoader - Scanning built-in extensions...
  DEBUG com.github.dandelion.datatables.core.generator.WebResourceGenerator - Transforming configuration to JSON...
  DEBUG com.github.dandelion.datatables.thymeleaf.processor.el.TableFinalizerElProcessor - Web content generated successfully
  DEBUG com.github.dandelion.datatables.core.configuration.DatatablesConfigurator - Initializing the Javascript generator...
  </code></pre>
  
  <p>Only warning I get:</p>
  
  <pre><code>WARN com.github.dandelion.core.asset.AssetMapper - No location found for delegate on AssetStorageUnit [name=dandelion-datatables, version=0.10.0, type=js, dom=null, locations={delegate=dandelion-datatables.js}, attributes=null, attributesOnlyName=[]]
  DEBUG com.github.dandelion.core.asset.cache.AssetCacheManager - Retrieving asset with the key 6c075191955bbb1ecbd703380e648817806cf15b/dandelion-datatables-0.10.0.js
  DEBUG com.github.dandelion.core.asset.cache.AssetCacheManager - Storing asset under the key 6c075191955bbb1ecbd703380e648817806cf15b/dandelion-datatables-0.10.0.js
  WARN com.github.dandelion.core.asset.AssetMapper - No location found for delegate on AssetStorageUnit [name=dandelion-datatables, version=0.10.0, type=js, dom=null, locations={delegate=dandelion-datatables.js}, attributes=null, attributesOnlyName=[]]
  DEBUG com.github.dandelion.core.asset.cache.AssetCacheManager - Retrieving asset with the key 6c075191955bbb1ecbd703380e648817806cf15b/dandelion-datatables-0.10.0.js
  DEBUG com.github.dandelion.core.asset.cache.AssetCacheManager - Storing asset under the key 6c075191955bbb1ecbd703380e648817806cf15b/dandelion-datatables-0.10.0.js
  </code></pre>
  
  <p>And finally:</p>
  
  <pre><code>&lt;table class="table table-striped table-bordered table-hover"
                              dt:table="true" id="myTable" dt:pagination="true"&gt;
  </code></pre>
  
  <p>When the page loads, the data loads but it isn't paginated; where'd I go wrong?</p>