JAVA-960: Migrate spring-static-resources to com.baeldung

This commit is contained in:
Krzysztof Woyke
2020-03-19 15:02:32 +01:00
parent b1cc7f4337
commit aa251bb22b
7 changed files with 9 additions and 9 deletions
@@ -0,0 +1,32 @@
package com.baeldung.web.controller;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;
@Controller
public class HomeController {
@Autowired
Environment env;
@RequestMapping(value = "/home", method = RequestMethod.GET)
public String showHome(WebRequest request, Model model, Locale locale) throws IOException {
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate);
return "home";
}
}