본문 바로가기
Spring/Spring Security

개발자 유미 - 스프링 시큐리티 2. 프로젝트 생성

by kimyoungrok 2025. 2. 9.
728x90

스프링 시큐리티 2 : 프로젝트 생성

 

개발자 유미 | 커뮤니티

 

개발자 유미 | 커뮤니티

 

www.devyummi.com

 

프로젝트 생성

필수 의존성

  • Spring Web
  • Lombok
  • Mustache
  • Spring Security
  • Spring Data JPA
  • MySQL Driver

start.spring.io

testsecurity.zip
0.05MB


MainController.java 생성

/controller/MainController.java

package com.example.testsecurity.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class MainController {
    @GetMapping("/")
    public String mainP() {
        return "main";
    }
}

main.mustache 생성

/templates/main.mustache

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Main Page</title>
</head>
<body>
main page
</body>
</html>

스프링 시큐리티 기본값

스프링 시큐리티 활성화 후 기본값이 적용되어 모든 경로에 대한 인증을 요구함.

기본 인증 정보

  • Username : user
  • Password : 콘솔 창의 security password 참고
728x90