How to include message.properties with thymeleaf

前端 未结 1 1511
臣服心动
臣服心动 2021-01-19 03:37

I am using spring boot with thymeleaf. This is my project structure: \"enter

And this

相关标签:
1条回答
  • 2021-01-19 04:24

    Refer the official documentation for spring boot

    http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-convert-an-existing-application-to-spring-boot

    It says

    Static resources can be moved to /public (or /static or /resources or /META-INF/resources) in the classpath root. Same for messages.properties (Spring Boot detects this automatically in the root of the classpath).

    So you should create ur internationalization file as messages.properties and place in the root classpath.

    Or you can also edit the default location to a more proper location by adding this entry in the application.properties file

    #messages
    spring.messages.basename=locale/messages
    

    so you can store your files in the locale folder inside resources folder, with the name messages.properties or in any specific language.

    0 讨论(0)
提交回复
热议问题