From 8bfb7df3b2c2463e9ea584bf79c9c19c8ef525ff Mon Sep 17 00:00:00 2001
From: Roman <32590063+oskar9247@users.noreply.github.com>
Date: Mon, 30 Mar 2020 22:25:55 +0200
Subject: [PATCH] BAEL-3822 Spring Boot MVC controller return HTML (#8988)
Co-authored-by: Oskar <>
---
.../com/baeldung/html/HtmlApplication.java | 12 ++++++++
.../com/baeldung/html/HtmlController.java | 17 +++++++++++
.../com/baeldung/html/HtmlControllerTest.java | 30 +++++++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java
create mode 100644 spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java
create mode 100644 spring-5-mvc/src/test/java/com/baeldung/html/HtmlControllerTest.java
diff --git a/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java
new file mode 100644
index 0000000000..ad660559c7
--- /dev/null
+++ b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java
@@ -0,0 +1,12 @@
+package com.baeldung.html;
+
+import org.springframework.boot.*;
+import org.springframework.boot.autoconfigure.*;
+
+@SpringBootApplication
+public class HtmlApplication
+{
+ public static void main(String[] args) {
+ SpringApplication.run(HtmlApplication.class, args);
+ }
+}
diff --git a/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java
new file mode 100644
index 0000000000..23674d165e
--- /dev/null
+++ b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java
@@ -0,0 +1,17 @@
+package com.baeldung.html;
+
+import org.springframework.http.*;
+import org.springframework.stereotype.*;
+import org.springframework.web.bind.annotation.*;
+
+@Controller
+public class HtmlController
+{
+ @GetMapping(value = "/welcome", produces = MediaType.TEXT_HTML_VALUE)
+ @ResponseBody
+ public String welcomeAsHTML()
+ {
+ return "\n" + "