Spring boot 로그인, 회원가입(1)

jjuya·2023년 10월 26일
0
post-thumbnail

개발환경

  • IDE: IntelliJ IDEA Community
  • Gradle - Groovy, Java 17
  • Jar 11
  • Spring Boot 2.7.6
  • JDK 11
  • mysql 8.0.35
  • Lombok
  • Spring Web
  • Spring Data JPA
  • Thymeleaf

spring boot

일단 spring boot 설치 먼저
https://start.spring.io/

여기서 아래와 같이 설정 맞춰주고

GENERATECTRL 버튼 꾸욱
(설정한대로 다운이 안될수도 있다고 하니 나중에 인텔리에서 한버더 확인하는걸로)

IntelliJ IDEA

그레이들 개발환경 맞추기!

build.gradle

의존성 추가하기

	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'

	implementation 'org.springframework.boot:spring-boot-starter-security'
	implementation 'org.springframework.boot:spring-boot-starter-validation'

	// third party - 비공식
	implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
	implementation group: 'com.auth0', name: 'java-jwt', version: '4.3.0'
    
    runtimeOnly'mysql:mysql-connector-java'
	compileOnly 'org.projectlombok:lombok'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'

application.yml

resources에 생성

server:
  port: 포트번호

  servlet:
    encoding:
      charset: UTF-8
      enabled: true
      force: true

spring: 
  servlet:
    multipart:
      max-file-size: 15MB
      max-request-size: 50MB
  output:
    ansi:
      enabled: ALWAYS
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:포트번호/스키마이름?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
    username: 아이디
    password: 비밀번호

  thymeleaf:
    cache: false

  jpa:
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    open-in-view: false
    show-sql: true
    hibernate:
      ddl-auto: create

  h2:
    console:
      enabled: true


jwt:
  secret:
    key: 시크릿키 설정

MySQL 설정

sql설정 하기

profile
Review the Record⭐

0개의 댓글