Sometimes it is necessary to transfer some variables from properties to a javascript file. When the js code is connected inline, there is no problem transferring the desired variable using thymeleaf. How can I transfer a certain variable from properties to js file? Thank you in advance!
At the moment I have 2 solutions: 1) Create @ControllerAdvice and add @ModelAttribute, and in the method return Map. Print it into thymeleaf using th: each. And then the script get the data attribute of the desired tag. 2) Create an @RestController with a GET method that returns a Map when it is accessed. And then the script makes an AYAX request to the URL and gets the necessary parameters.