The application.yaml file with general information, active profile set to prod_pg:

The specific environment file, e.g. application-prod_pg.yaml will have the variables specific to production, postgress:

The specific environment file, e.g. application-dev_pg.yaml will have the variables specific to development, postgress:

@Controller
public class HomeController {
@Value("${env}")
private String env;
@Value("${baseUrl}")
private String baseUrl;
@GetMapping("/")
public String home(Model model)
{
String cssUrl = baseUrl + "/css/";
String jsUrl = baseUrl + "/js/";
String theme = "light";
String company = "cba";
String bundle = "bundle";
String endpoints = "endpoints";
//CSS files
model.addAttribute("cssFileName1", cssUrl + theme + ".css");
model.addAttribute("cssFileName2", cssUrl + company + ".css");
//Js files
model.addAttribute("jsFileName1", jsUrl + bundle + ".js");
model.addAttribute("jsFileName2", jsUrl +endpoints + ".js");
//Js variables
model.addAttribute("baseUrl", baseUrl);
String pageTitle = "Store Application";
model.addAttribute("pageTitle", pageTitle);
return "index";
}
<link rel="stylesheet" th:href="@{{fileName}(fileName=${cssFileName1})}">
<link rel="stylesheet" th:href="@{{fileName}(fileName=${cssFileName2})}">
<script type="module" th:src="@{{fileName}(fileName=${jsFileName1})}">
<script th:src="@{{fileName}(fileName=${jsFileName2})}"></script>
<title th:text="${pageTitle}"></title>