#Programming

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
@Controller
public class HomeController {
@GetMapping("/")
public String getHomePage() {
return "home";
}
}
This is a basic simple controller that returns “home.html” page when opening the “/” path of your server. After adding the above specified dependency, restart your app and you will see that now the application is secured and the app shows a Login form before accessing the “/” path of your server.
But what are the credentials for logging in? So, by default Spring Security uses "User" as login and the hashed password is logged into the console after you start the app.
You can just copy it and paste into “Password” field. Voila, you now have the secured Spring Boot app. Of course for production environment, this is not a very good idea to use such approach and more thorough configuration will be required. That is what we will cover in next tutorials.