家族について考えるパパのブログ

普段の生活をいかに快適に過ごすかを考えて実践をしていくブログ

【Spring Boot:対処中】詰まったこと(spring.resources.cache-period)

こんにちは。

 

今日は、Spring Bootの学習をしていく上で詰まっていることをメモ的に残しておきます。(解決したら更新を行います)

 

 

 

今回起こっている問題

静的ファイルのキャッシュ設定をした際にエラーが発生

 

今回は静的ファイルのキャッシュ設定をしようとした際に詰まっていることです。

Spring Bootでは静的ファイルのキャッシュ設定はデフォルトでは行われないため、

spring.resources.cache-periodで設定を行うことができます。

 

そこで設定をしようとしたところ、以下エラーログのようなエラーが起こって起動しなくなりました。

エラーログ

 


:: Spring Boot :: (v2.1.0.RELEASE)

2018-11-12 02:35:48.276 INFO 13236 --- [ restartedMain] com.example.demo.DemoApplication : Starting DemoApplication on DESKTOP-RFATJFB with PID 13236 (D:\workspace\spring-practice\demo\target\classes started by 19941 in D:\workspace\spring-practice\demo)
2018-11-12 02:35:48.283 INFO 13236 --- [ restartedMain] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2018-11-12 02:35:48.358 INFO 13236 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2018-11-12 02:35:48.358 INFO 13236 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2018-11-12 02:35:50.114 WARN 13236 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$$EnhancerBySpringCGLIB$$6549639e]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties': Could not bind properties to 'ResourceProperties' : prefix=spring.resources, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.resources' to org.springframework.boot.autoconfigure.web.ResourceProperties
2018-11-12 02:35:50.130 INFO 13236 --- [ restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-12 02:35:50.132 ERROR 13236 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target [Bindable@24c78ee4 type = org.springframework.boot.autoconfigure.web.ResourceProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(value=spring.resources, prefix=spring.resources, ignoreUnknownFields=false, ignoreInvalidFields=false)]] failed:

Property: spring.resources.cache-period
Value: 86400
Origin: class path resource [application.properties]:1:31
Reason: The elements [spring.resources.cache-period] were left unbound.

Action:

Update your application's configuration

 

 

 

原因

調査中

 

関連しそうな検索結果

検索結果1

解決策

調査中

 

今日は、こんな時間なので解決し次第、更新をします。