java - Accessing properties file in Spring Expression Language -


I have created a simple web application with Themelif using Spring Boot I have applied the application.properties file as a configuration I use What I would like to do is add new properties such as name and version to that file and get the values ​​of thimmelaf.

I am able to get it by creating a new Java configuration class and highlighting a spring Bean:

@configment Application for Public Category {@Value ("$ {Name} ") private string name; @bean public string name () {return name; }}

Then I can display it in a template using Thymeleaf:

  & lt; Span th: text = "$ {@ name}" & gt; & Lt; / Span & gt;  

This is a lot more functional and complex for me.

If possible, I would like to avoid using XML configuration.

You can get it through the environment eg .: < / P>

  $ {@ environment.getProperty ('name')}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -