# application.properties
db.url=jdbc:mysql://localhost:3306/mydatabase
db.username=myuser
db.password=mypassword
context.path=/myapp
@Controller
public class MyController {
@Autowired
private MyService myService;
@RequestMapping("/hello")
public String sayHello(Model model) {
String message = myService.getMessage();
model.addAttribute("message", message);
return "hello";
}
}
html
<!-- hello.html -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Hello Page</title>
</head>
<body>
<h1 th:text="${message}"></h1>
</body>
</html>