• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    해결됨

Kotlin: Unresolved reference: MappedSuperclass

24.03.17 02:37 작성 24.03.17 02:42 수정 조회수 97

1

실습 2 클래스 생성 3분 에아래 코드를 작성했는데

@MappedSuperclass

Kotlin: Unresolved reference: MappedSuperclass

오류가 떠요 "persistence" 이것도 안보여요

import jakarta.persistence.MappedSuperclass

 

build.gradle.kts 의존성은 아래처럼 되어 있어요

 

plugins {
    id("org.springframework.boot") version "3.2.3"
    id("io.spring.dependency-management") version "1.1.4"
    kotlin("jvm") version "1.9.22"
    kotlin("plugin.spring") version "1.9.22"
}

 

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
    implementation("org.springframework.boot:spring-boot-starter-validation")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    runtimeOnly("com.h2database:h2")
    runtimeOnly("com.mysql:mysql-connector-j")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

 

깃은

https://github.com/justkjy/portfolio-justkim

 

입니다.

 

왜 못찾는다고 할까요?

 

추가

왜 JPA 관련 에러가 계속 나는걸까요??

답변 2

·

답변을 작성해보세요.

0

just kim님의 프로필

just kim

질문자

2024.03.17

와 감사합니다. 꼭 완강해서 Spring Boot 실력을 업그레이드 할께욥 ^^ 글고 답변이 상세/ 정확/ 깔끔하네요 감사합니다.

0

안녕하세요 정보근입니다:)

 

올려주신 build.gradle.kts 내용을 보면 Spring Data JPA 의존성이 빠져있네요.

 

jarkata.persistence 패키지는 Spring Data JPA에 포함되어 있습니다.

인텔리제이의 Gradle 탭을 열고, 맥 기준 cmd+f를 누른 후 검색창에 jarkata.persistence를 입력하시면,

아래 이미지처럼 org.springframework.boot:spring-boot-starter-data-jpa:3.1.4에 포함되어 있는 것을 확인하실 수 있습니다.

(expand all 버튼을 누른 후 검색하셔야 검색이 됩니다)

 

image

아래 현재 진행 중이신 단계에서 필요한 의존성을 포함한 코드를 첨부드립니다.

Spring Security와 jasypt는 강의를 진행하면서 추가하게 되어 주석처리 해두었습니다.

 

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
    implementation("org.springframework.boot:spring-boot-starter-validation")
    // implementation("org.springframework.boot:spring-boot-starter-security")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    // implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5")
    runtimeOnly("com.h2database:h2")
    runtimeOnly("com.mysql:mysql-connector-j")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

 

감사합니다.