@Controller
public class TestController {
@RequestMapping("/")
public String test(){
return "test";
}
public static String toLowerCase(String s){
return s.toLowerCase();
}
}4、src/main/resources/templates/test.html
<div th:text="${T(com.example.demo.TestUtils).toUpperCase('hello world 1')}"></div>
<div th:text="${T(com.example.demo.TestController).toLowerCase('HELLO WORLD 2')}"></div>