title: Spring boot timeout config exception
body: <p>I'm using Spring Boot version 2.1.9.RELEASE with web, session, security, jdbc and jpa starters.
  Everything is ok in my application, until I try to override the default session timeout value, with the following line in the application.properties:</p>
  
  <pre><code>server.servlet.session.timeout=180
  </code></pre>
  
  <p>If this line is added, when starting Spring I get the following error:</p>
  
  <pre><code>2019-12-02 17:48:17.689  INFO 12824 --- [           main] o.a.c.c.C.[.[localhost].[/webapp]        : Initializing Spring embedded WebApplicationContext 
  2019-12-02 17:48:17.689  INFO 12824 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 11388 ms 
  2019-12-02 17:48:17.955  WARN 12824 --- [           main] 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.UnsatisfiedDependencyException: Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.session-org.springframework.boot.autoconfigure.session.SessionProperties': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.session.SessionProperties]: Constructor threw exception; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'server-org.springframework.boot.autoconfigure.web.ServerProperties': Could not bind properties to 'ServerProperties' : prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server.servlet.session.timeout' to java.time.Duration 
  2019-12-02 17:48:17.971  INFO 12824 --- [           main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 
  2019-12-02 17:48:17.971 ERROR 12824 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
  
   *************************** APPLICATION FAILED TO START
   ***************************
  
   Description:
  
   Failed to bind properties under 'server.servlet.session.timeout' to java.time.Duration:
  
       Property: server.servlet.session.timeout
       Value: 180
       Origin: "server.servlet.session.timeout" from property source "URL [file:C:/Users/utente/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/configurazioni/application.properties]"
       Reason: failed to convert java.lang.String to @org.springframework.boot.convert.DurationUnit java.time.Duration
  
   Action:
  
  Update your application's configuration
  </code></pre>
  
  <p>I also tried different formats, such as 180s or PT180S, but nothing worked.
  According to <a href="https://docs.spring.io/spring-session/docs/2.0.10.RELEASE/reference/html5/guides/boot-jdbc.html" rel="nofollow noreferrer">Spring documentation</a> or other variants of the same doc, the version with only the integer should be correct</p>
  
  <blockquote>
    <p>Further customization is possible using application.properties:</p>
    
    <p>src/main/resources/application.properties server.servlet.session.timeout= # Session timeout. If a duration suffix is not specified, seconds will be used.</p>
  </blockquote>
  
  <p><a href="https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-conversion" rel="nofollow noreferrer">Another documentation</a> page explains the other formats and I understand that the standard should work, without declaring beans (I understand that is Spring boot itself who is declaring the standard ConverstionService, is it correct? Or should I specify something in my @Configuration class?).</p>
  
  <p>I really don't understand what I'm missing, please help me.</p>
  
  <p><strong>EDIT</strong>: I also tried to explicitly expose an ApplicationConversionService bean as explained in another <a href="https://stackoverflow.com/questions/51818137/spring-boot-2-converting-duration-java-8-application-properties">question</a>, but it doesn't work, exactly same result as before.</p>