This tutorial shows how to use application.properties to specify single custom User (you can't specify multiple Users).
Application Schema [Results]
Spring Boot Starters
Create Project: springboot_security_default (add Spring Boot Starters from the table)
Edit File: application.properties (contains Role, User, Password)
Create Package: controllers (inside main package)
– Create Class: MyController.java (inside controllers package)
application.properties
# SECURITY
spring.security.user.name = myuser
spring.security.user.password = mypassword
spring.security.user.roles = USER
MyController.java
package com.ivoronline.springboot_security_user_applicationproperties.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class MyController {
@ResponseBody
@RequestMapping("/Hello")
public String hello() {
return "Hello from Controller";
}
}