How to display messages in Thymeleaf and Spring Boot?

后端 未结 5 1858
深忆病人
深忆病人 2021-02-01 05:58

I created a Spring Boot web application that uses Thymeleaf as the template engine. I configured the MessageSource to look for messages in a subfolder:



        
5条回答
  •  生来不讨喜
    2021-02-01 06:22

    Because I am using Spring Boot, the MessageSource is configured with a MessageSourceAutoConfiguration. These settings can be easily changed in the application.properties file. In my case I had to add the following to this file:

    spring.messages.basename=i18n/messages
    

提交回复
热议问题