title: After docker-compose build language switching does not work
body: <p>After adding my application in docker container, language switching does not work correctly ... I found out that switching partially works. Objects that are taken from the database are displayed in the desired language. And the text that is taken from messages.properties is displayed only in English. Although I have added two languages ​​(Russian and English). Why is this happening and how to fix this problem?</p>
  
  <p>I guess the case may be in <code>messageSource.setBasename ("classpath: messages")</code>.</p>
  
  <pre><code>@Configuration
  class WebConfig: WebMvcConfigurer {
  
      @Bean
      fun  localeResolver(): LocaleResolver {
          val slr = SessionLocaleResolver()
          slr.setDefaultLocale(UtilsLocale.getDefault())
          return slr;
      }
  
      @Bean
      fun localeChangeInterceptor(): LocaleChangeInterceptor {
          val lci = LocaleChangeInterceptor()
          lci.paramName = "language"
          return lci
      }
  
      @Bean
      fun messageSource(): MessageSource {
          val messageSource = ReloadableResourceBundleMessageSource()
          messageSource.setBasename("classpath:messages")
          messageSource.setDefaultEncoding("UTF-8")
          return messageSource
      }
  
      @Bean
      fun validator(): LocalValidatorFactoryBean {
          val bean = LocalValidatorFactoryBean()
          bean.setValidationMessageSource(messageSource())
          return bean
      }
  
      override fun addInterceptors(registry: InterceptorRegistry) {
          registry.addInterceptor(localeChangeInterceptor())
      }
  
  }
  
  @Component
  object UtilsLocale {
      val LOCALE_RU = Locale("ru", "RU")
      val LOCALE_EN = Locale.ENGLISH
  
      fun getDefault(): Locale = LOCALE_RU
  
      fun getAll(): Array&lt;Locale&gt; = arrayOf(LOCALE_RU, LOCALE_EN)
  }
  </code></pre>
  
  <p>This is Dockerfile:</p>
  
  <pre><code>FROM anapsix/alpine-java:8_jdk
  
  MAINTAINER Zemtsov Alexey Vladimirovich &lt;***&gt;
  
  ARG CONTEXT_PATH
  ARG DB_HOST
  ARG DB_PORT
  ARG DB_NAME
  ARG DB_USER
  ARG DB_PASSWORD
  ARG MAIL_LOGIN
  ARG MAIL_PASSWORD
  
  ENV PATH_DIR /tmp/webapp
  
  WORKDIR $PATH_DIR
  
  ADD target/webapp-*.jar webapp.jar
  
  EXPOSE 8080
  
  ENTRYPOINT java -jar webapp.jar
  </code></pre>
  
  <p>This is docker-compose.yml</p>
  
  <pre><code>version: '3.7'
  
  services:
  
    db:
      image: mysql:8.0.17
      command: --default-authentication-plugin=mysql_native_password
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: ****
      ports:
        - 3306:3306
      volumes:
        - /home/alexey/temp/mysql01:/var/lib/mysql
  
    adminer:
      image: adminer
      restart: always
      ports:
        - 3380:8080
  
    webapp:
      build:
        context: .
      environment:
        CONTEXT_PATH: /a-test
        DB_HOST: db
        DB_PORT: 3306
        DB_NAME: ****
        DB_USER: ****
        DB_PASSWORD: ****
        MAIL_LOGIN: ****
        MAIL_PASSWORD: ****
      ports:
        - 80:8080
      volumes:
        - /home/alexey/temp/webapp/logs:/tmp/webapp/logs
      depends_on:
        - db
  </code></pre>
  
  <p><strong>EDITED:</strong> This is log sys props^</p>
  
  <pre><code>[INFO ] 2019-09-11 15:35:03.186 [main] PropertiesLogger - ******* systemProperties *******
  [INFO ] 2019-09-11 15:35:03.229 [main] PropertiesLogger - PID=1
  [INFO ] 2019-09-11 15:35:03.233 [main] PropertiesLogger - awt.toolkit=sun.awt.X11.XToolkit
  [INFO ] 2019-09-11 15:35:03.234 [main] PropertiesLogger - file.encoding=UTF-8
  [INFO ] 2019-09-11 15:35:03.235 [main] PropertiesLogger - file.encoding.pkg=sun.io
  [INFO ] 2019-09-11 15:35:03.237 [main] PropertiesLogger - file.separator=/
  [INFO ] 2019-09-11 15:35:03.239 [main] PropertiesLogger - java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
  [INFO ] 2019-09-11 15:35:03.241 [main] PropertiesLogger - java.awt.headless=true
  [INFO ] 2019-09-11 15:35:03.242 [main] PropertiesLogger - java.awt.printerjob=sun.print.PSPrinterJob
  [INFO ] 2019-09-11 15:35:03.244 [main] PropertiesLogger - java.class.path=webapp.jar
  [INFO ] 2019-09-11 15:35:03.246 [main] PropertiesLogger - java.class.version=52.0
  [INFO ] 2019-09-11 15:35:03.248 [main] PropertiesLogger - java.endorsed.dirs=/opt/jdk1.8.0_202/jre/lib/endorsed
  [INFO ] 2019-09-11 15:35:03.249 [main] PropertiesLogger - java.ext.dirs=/opt/jdk1.8.0_202/jre/lib/ext:/usr/java/packages/lib/ext
  [INFO ] 2019-09-11 15:35:03.253 [main] PropertiesLogger - java.home=/opt/jdk1.8.0_202/jre
  [INFO ] 2019-09-11 15:35:03.268 [main] PropertiesLogger - java.io.tmpdir=/tmp
  [INFO ] 2019-09-11 15:35:03.269 [main] PropertiesLogger - java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
  [INFO ] 2019-09-11 15:35:03.271 [main] PropertiesLogger - java.protocol.handler.pkgs=org.springframework.boot.loader
  [INFO ] 2019-09-11 15:35:03.272 [main] PropertiesLogger - java.runtime.name=Java(TM) SE Runtime Environment
  [INFO ] 2019-09-11 15:35:03.272 [main] PropertiesLogger - java.runtime.version=1.8.0_202-b08
  [INFO ] 2019-09-11 15:35:03.281 [main] PropertiesLogger - java.specification.name=Java Platform API Specification
  [INFO ] 2019-09-11 15:35:03.282 [main] PropertiesLogger - java.specification.vendor=Oracle Corporation
  [INFO ] 2019-09-11 15:35:03.282 [main] PropertiesLogger - java.specification.version=1.8
  [INFO ] 2019-09-11 15:35:03.283 [main] PropertiesLogger - java.vendor=Oracle Corporation
  [INFO ] 2019-09-11 15:35:03.283 [main] PropertiesLogger - java.vendor.url=http://java.oracle.com/
  [INFO ] 2019-09-11 15:35:03.284 [main] PropertiesLogger - java.vendor.url.bug=http://bugreport.sun.com/bugreport/
  [INFO ] 2019-09-11 15:35:03.292 [main] PropertiesLogger - java.version=1.8.0_202
  [INFO ] 2019-09-11 15:35:03.292 [main] PropertiesLogger - java.vm.info=mixed mode
  [INFO ] 2019-09-11 15:35:03.293 [main] PropertiesLogger - java.vm.name=Java HotSpot(TM) 64-Bit Server VM
  [INFO ] 2019-09-11 15:35:03.293 [main] PropertiesLogger - java.vm.specification.name=Java Virtual Machine Specification
  [INFO ] 2019-09-11 15:35:03.294 [main] PropertiesLogger - java.vm.specification.vendor=Oracle Corporation
  [INFO ] 2019-09-11 15:35:03.295 [main] PropertiesLogger - java.vm.specification.version=1.8
  [INFO ] 2019-09-11 15:35:03.302 [main] PropertiesLogger - java.vm.vendor=Oracle Corporation
  [INFO ] 2019-09-11 15:35:03.306 [main] PropertiesLogger - java.vm.version=25.202-b08
  [INFO ] 2019-09-11 15:35:03.311 [main] PropertiesLogger - line.separator=
  
  [INFO ] 2019-09-11 15:35:03.315 [main] PropertiesLogger - os.arch=amd64
  [INFO ] 2019-09-11 15:35:03.316 [main] PropertiesLogger - os.name=Linux
  [INFO ] 2019-09-11 15:35:03.316 [main] PropertiesLogger - os.version=4.15.0-60-generic
  [INFO ] 2019-09-11 15:35:03.316 [main] PropertiesLogger - path.separator=:
  [INFO ] 2019-09-11 15:35:03.317 [main] PropertiesLogger - spring.beaninfo.ignore=true
  [INFO ] 2019-09-11 15:35:03.317 [main] PropertiesLogger - sun.arch.data.model=64
  [INFO ] 2019-09-11 15:35:03.318 [main] PropertiesLogger - sun.boot.class.path=/opt/jdk1.8.0_202/jre/lib/resources.jar:/opt/jdk1.8.0_202/jre/lib/rt.jar:/opt/jdk1.8.0_202/jre/lib/sunrsasign.jar:/opt/jdk1.8.0_202/jre/lib/jsse.jar:/opt/jdk1.8.0_202/jre/lib/jce.jar:/opt/jdk1.8.0_202/jre/lib/charsets.jar:/opt/jdk1.8.0_202/jre/lib/jfr.jar:/opt/jdk1.8.0_202/jre/classes
  [INFO ] 2019-09-11 15:35:03.318 [main] PropertiesLogger - sun.boot.library.path=/opt/jdk1.8.0_202/jre/lib/amd64
  [INFO ] 2019-09-11 15:35:03.319 [main] PropertiesLogger - sun.cpu.endian=little
  [INFO ] 2019-09-11 15:35:03.319 [main] PropertiesLogger - sun.cpu.isalist=
  [INFO ] 2019-09-11 15:35:03.320 [main] PropertiesLogger - sun.io.unicode.encoding=UnicodeLittle
  [INFO ] 2019-09-11 15:35:03.326 [main] PropertiesLogger - sun.java.command=webapp.jar
  [INFO ] 2019-09-11 15:35:03.331 [main] PropertiesLogger - sun.java.launcher=SUN_STANDARD
  [INFO ] 2019-09-11 15:35:03.331 [main] PropertiesLogger - sun.jnu.encoding=UTF-8
  [INFO ] 2019-09-11 15:35:03.332 [main] PropertiesLogger - sun.management.compiler=HotSpot 64-Bit Tiered Compilers
  [INFO ] 2019-09-11 15:35:03.335 [main] PropertiesLogger - sun.os.patch.level=unknown
  [INFO ] 2019-09-11 15:35:03.341 [main] PropertiesLogger - user.dir=/tmp/webapp
  [INFO ] 2019-09-11 15:35:03.350 [main] PropertiesLogger - user.home=/root
  [INFO ] 2019-09-11 15:35:03.351 [main] PropertiesLogger - user.language=en
  [INFO ] 2019-09-11 15:35:03.351 [main] PropertiesLogger - user.name=root
  [INFO ] 2019-09-11 15:35:03.352 [main] PropertiesLogger - user.timezone=GMT
  [INFO ] 2019-09-11 15:35:03.352 [main] PropertiesLogger - ******* systemEnvironment *******
  [INFO ] 2019-09-11 15:35:03.352 [main] PropertiesLogger - CONTEXT_PATH=/a-test
  [INFO ] 2019-09-11 15:35:03.353 [main] PropertiesLogger - DB_HOST=db
  [INFO ] 2019-09-11 15:35:03.353 [main] PropertiesLogger - DB_NAME=****
  [INFO ] 2019-09-11 15:35:03.353 [main] PropertiesLogger - DB_PASSWORD=****
  [INFO ] 2019-09-11 15:35:03.353 [main] PropertiesLogger - DB_PORT=3306
  [INFO ] 2019-09-11 15:35:03.354 [main] PropertiesLogger - DB_USER=***
  [INFO ] 2019-09-11 15:35:03.354 [main] PropertiesLogger - GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
  [INFO ] 2019-09-11 15:35:03.354 [main] PropertiesLogger - GLIBC_VERSION=2.29-r0
  [INFO ] 2019-09-11 15:35:03.355 [main] PropertiesLogger - HOME=/***
  [INFO ] 2019-09-11 15:35:03.356 [main] PropertiesLogger - HOSTNAME=16adb4c57c07
  [INFO ] 2019-09-11 15:35:03.357 [main] PropertiesLogger - JAVA_HOME=/opt/jdk
  [INFO ] 2019-09-11 15:35:03.357 [main] PropertiesLogger - JAVA_JCE=standard
  [INFO ] 2019-09-11 15:35:03.358 [main] PropertiesLogger - JAVA_PACKAGE=jdk
  [INFO ] 2019-09-11 15:35:03.358 [main] PropertiesLogger - JAVA_VERSION_BUILD=08
  [INFO ] 2019-09-11 15:35:03.359 [main] PropertiesLogger - JAVA_VERSION_MAJOR=8
  [INFO ] 2019-09-11 15:35:03.360 [main] PropertiesLogger - JAVA_VERSION_MINOR=202
  [INFO ] 2019-09-11 15:35:03.361 [main] PropertiesLogger - LANG=C.UTF-8
  [INFO ] 2019-09-11 15:35:03.362 [main] PropertiesLogger - MAIL_LOGIN=****
  [INFO ] 2019-09-11 15:35:03.362 [main] PropertiesLogger - MAIL_PASSWORD=****
  [INFO ] 2019-09-11 15:35:03.363 [main] PropertiesLogger - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk/bin
  [INFO ] 2019-09-11 15:35:03.364 [main] PropertiesLogger - PATH_DIR=/tmp/webapp
  [INFO ] 2019-09-11 15:35:03.364 [main] PropertiesLogger - PWD=/tmp/webapp
  [INFO ] 2019-09-11 15:35:03.365 [main] PropertiesLogger - SHLVL=1
  [INFO ] 2019-09-11 15:35:03.365 [main] PropertiesLogger - ******* applicationConfig: [classpath:/application.yml] *******
  [INFO ] 2019-09-11 15:35:03.366 [main] PropertiesLogger - entitymanager.packagesToScan=work.chessman.webapp.database.entity
  [INFO ] 2019-09-11 15:35:03.369 [main] PropertiesLogger - server.port=8080
  [INFO ] 2019-09-11 15:35:03.380 [main] PropertiesLogger - server.servlet.context-path=${CONTEXT_PATH} OVERRIDDEN to /a-test
  [INFO ] 2019-09-11 15:35:03.386 [main] PropertiesLogger - server.tomcat.max-http-post-size=1073741824
  [INFO ] 2019-09-11 15:35:03.391 [main] PropertiesLogger - spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  [INFO ] 2019-09-11 15:35:03.400 [main] PropertiesLogger - spring.datasource.initial-size=5
  [INFO ] 2019-09-11 15:35:03.404 [main] PropertiesLogger - spring.datasource.initialization-mode=always
  [INFO ] 2019-09-11 15:35:03.406 [main] PropertiesLogger - spring.datasource.max-active=50
  [INFO ] 2019-09-11 15:35:03.411 [main] PropertiesLogger - spring.datasource.max-idle=10
  [INFO ] 2019-09-11 15:35:03.418 [main] PropertiesLogger - spring.datasource.min-idle=5
  [INFO ] 2019-09-11 15:35:03.420 [main] PropertiesLogger - spring.datasource.password=${DB_PASSWORD} OVERRIDDEN to ******
  [INFO ] 2019-09-11 15:35:03.422 [main] PropertiesLogger - spring.datasource.platform=mysql
  [INFO ] 2019-09-11 15:35:03.426 [main] PropertiesLogger - spring.datasource.test-on-borrow=true
  [INFO ] 2019-09-11 15:35:03.431 [main] PropertiesLogger - spring.datasource.url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?zeroDateTimeBehavior=CONVERT_TO_NULL&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;createDatabaseIfNotExist=true OVERRIDDEN to jdbc:mysql://db:3306/chessman_work?zeroDateTimeBehavior=CONVERT_TO_NULL&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;createDatabaseIfNotExist=true
  [INFO ] 2019-09-11 15:35:03.438 [main] PropertiesLogger - spring.datasource.username=${DB_USER} OVERRIDDEN to root
  [INFO ] 2019-09-11 15:35:03.440 [main] PropertiesLogger - spring.datasource.validation-query=SELECT 1
  [INFO ] 2019-09-11 15:35:03.441 [main] PropertiesLogger - spring.jpa.generate-ddl=true
  [INFO ] 2019-09-11 15:35:03.448 [main] PropertiesLogger - spring.jpa.hibernate.ddl-auto=update
  [INFO ] 2019-09-11 15:35:03.448 [main] PropertiesLogger - spring.jpa.properties.hibernate.current_session_context_class=thread
  [INFO ] 2019-09-11 15:35:03.449 [main] PropertiesLogger - spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
  [INFO ] 2019-09-11 15:35:03.450 [main] PropertiesLogger - spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
  [INFO ] 2019-09-11 15:35:03.450 [main] PropertiesLogger - spring.jpa.show-sql=false
  [INFO ] 2019-09-11 15:35:03.471 [main] PropertiesLogger - spring.mail.default-encoding=UTF-8
  [INFO ] 2019-09-11 15:35:03.475 [main] PropertiesLogger - spring.mail.host=smtp.gmail.com
  [INFO ] 2019-09-11 15:35:03.487 [main] PropertiesLogger - spring.mail.password=${MAIL_PASSWORD} OVERRIDDEN to *****
  [INFO ] 2019-09-11 15:35:03.488 [main] PropertiesLogger - spring.mail.port=587
  [INFO ] 2019-09-11 15:35:03.489 [main] PropertiesLogger - spring.mail.properties.mail.smtp.auth=true
  [INFO ] 2019-09-11 15:35:03.489 [main] PropertiesLogger - spring.mail.properties.mail.smtp.starttls.enable=true
  [INFO ] 2019-09-11 15:35:03.490 [main] PropertiesLogger - spring.mail.properties.mail.smtp.starttls.required=true
  [INFO ] 2019-09-11 15:35:03.491 [main] PropertiesLogger - spring.mail.protocol=smtp
  [INFO ] 2019-09-11 15:35:03.506 [main] PropertiesLogger - spring.mail.test-connection=false
  [INFO ] 2019-09-11 15:35:03.507 [main] PropertiesLogger - spring.mail.username=${MAIL_LOGIN} OVERRIDDEN to *****
  [INFO ] 2019-09-11 15:35:03.508 [main] PropertiesLogger - spring.servlet.multipart.max-file-size=1024MB
  [INFO ] 2019-09-11 15:35:03.509 [main] PropertiesLogger - spring.servlet.multipart.max-request-size=1024MB
  </code></pre>
  
  <p><strong>EDITED:</strong> After adding the <code>messages_ru_RU.properties</code> file, the standard language became Russian, but when I choose to switch to English, the language does not switch back ...</p>
  
  <p><a href="https://i.stack.imgur.com/joig9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/joig9.png" alt="enter image description here"></a></p>
  
  <p><strong>EDITED:</strong> in html language set normal after switch
  <a href="https://i.stack.imgur.com/z7mjm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z7mjm.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/6lrHr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6lrHr.png" alt="enter image description here"></a></p>