Bael 5436 new (#13283)

* BAEL-5777 - Mocking a singleton with Mockito

* BAEL-5436 - Root mapping

* Revert "BAEL-5777 - Mocking a singleton with Mockito"

This reverts commit 358a061997a4b853e3215dea0217a070f0e391e4.

* BAEL-5436 - Uncommenting controller
This commit is contained in:
Abhinav Pandey 2023-01-14 11:37:48 +05:30 committed by GitHub
parent c0157effb0
commit e80b67b507
4 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package com.baeldung.rootmapping;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@SpringBootApplication
@EnableWebMvc
public class RootMappingApplication {
public static void main(String[] args) {
SpringApplication.run(RootMappingApplication.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.baeldung.rootmapping.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
}
}

View File

@ -0,0 +1,12 @@
package com.baeldung.rootmapping.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class RootController {
@GetMapping("/")
public String index() {
return "index";
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>