GroovyでSpring Boot 1.2.0を使ってtemplates/がないエラーになる時の対処


## 概要
以下の条件を満たした時にエラーが起きるのに対処する。

* [Spring Boot](http://projects.spring.io/spring-boot/) **1.2.0** を使う
* Groovyのdependencyに **groovy-all** を使う
* Thymeleafのようなテンプレートを使わない（main/resources/templatesディレクトリがない）

## 起きる現象
スタックトレースを載せた通り、アプリケーションのスタートに失敗する。

## 対処方法
最も手軽にできる対処方法は、application.ymlに以下を追加すること。

```yaml
spring.groovy.template.check-template-location: false

```

## 原因？
Spring Boot 1.2.0 RC1から、spring.groovy.template.check-template-locationがデフォルトtrueになったこと？
GitHubを見ると、色々経緯はあるみたい。

* [springgroovy.template.check-template-location default value #1915](https://github.com/spring-projects/spring-boot/issues/1915)
* [groovy + spring boot 1.2.0.RELEASE doesn't work with default autoconfiguration #2190](https://github.com/spring-projects/spring-boot/issues/2190)

## 今後
GitHubの#2190にあるように、次の1.2.1では解消されてリリースされる予定なので、今回の対処方法は1.2.0限定になりそう。

## スタックトレース
```
2015-01-03 10:51:44.954 ERROR 3272 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration$GroovyMarkupConfiguration
': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot find template location: class path resource [templates/] (please add some templates, check your Groovy
configuration, or set spring.groovy.template.check-template-location=false)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1558)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
        at org.springframework.boot.SpringApplication$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at net.mas0061.lateron.server.Application.main(Application.groovy:13)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Cannot find template location: class path resource [templates/] (please add some templates, check your Groovy configuration, or set spring.groovy.template.c
heck-template-location=false)
        at org.springframework.util.Assert.state(Assert.java:385)
        at org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration$GroovyMarkupConfiguration.checkTemplateLocationExists(GroovyTemplateAutoConfiguration.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
        ... 27 more

```