docker-compose 파일 작성하기 질문 있습니다.
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
docker-compose 실행을 하면 사진과 같은 오류가 발생하는데 어떻게 해결해야할 지 모르겠습니다. 인터넷에 찾아봐도 자료가 많지 않아 질문 드립니다. .
- kotlin
- mysql
- docker
- spring-boot
- jpa
173만명의 커뮤니티!! 함께 토론해봐요.
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
docker-compose 실행을 하면 사진과 같은 오류가 발생하는데 어떻게 해결해야할 지 모르겠습니다. 인터넷에 찾아봐도 자료가 많지 않아 질문 드립니다. .
미해결
2시간으로 끝내는 코루틴
강사님 강의를 듣고 배치 단위로 요청을 가져와 Redis 서버에서 작업을 처리 하는 부분에 코루틴을 적용하려고 합니다. 강의를 통해 최소한의 스레드로 여러 코루틴을 실행해야 코루틴을 극대화할 수 있다고 이해했습니다. n개의 요청은 모두 독립적이며 배치 단위로 가져온 이유는 1개의 스레드로 여러 코루틴을 실행하기 위함 입니다. Redis는 마스터에서만 작업이 가능하므로 요청을 보내고, 응답받아 후속 처리하는 부분을 Redis 서버로 요청 (코루틴1) Redis 서버로부터 응답받아 후속 처리 (코루틴2) 로 분리했습니다. 1개의 스레드에서 여러 코루틴을 동작시키기 위해 이런 기준으로 코루틴의 중단 지점을 생성하는 것이 적절한지 궁금합니다. 또한 n개의 요청을 모두 Redis 서버로 보낸 후 응답 받는 것이 아니라 응답을 받고 후속 처리가 가능한 요청은 ‘모든 요청을 Redis 서버로 전달했다는 여부와 상관없이’ 후속처리를 하기 위해 다음과 같이 코드를 작성했습니다. coroutineScope { val jobs = userIds.map { userId -> async { // main 스레드가 처리 val result = 레디스 접근 메서드 (RedisTemplate) Pair(userId, result) } } jobs.forEach { job -> launch(Dispatchers.IO) { val (userId, status) = job.await() // 응답에 대한 후속 처리 // 결과마다 다른 DefaultDispatcher-worker 가 처리 } } } 위와 같이 작성하면 Redis로 요청을 보내는 부분은 1개의 main스레드가 처리하지만, 후속 처리는 결과마다 다른 DefaultDispatcher-workder가 처리 합니다. 이는 결과마다 다른 스레드가 처리하는 것이 맞다면 이 코드는 코루틴을 제대로 사용하지 못하고 있다고 생각하는데 제 생각이 맞는지 궁금합니다. coroutineScope { launch { for(userId in userIds) { val result = 레디스 접근 메서드 channel.send(Pair(userId, result)) } channel.close() } launch { for(result in channel) { // 응답에 대한 후속 처리 } } } 위와 같이 작성하면 1개의 main 스레드가 모든 작업을 처리 합니다. 이렇게 작성해야 코루틴을 제대로 사용하는 것이 맞는지 궁금합니다. 강의 잘 들었고 감사합니다!
미해결
코틀린 코루틴 완전 정복
안녕하세요. 1) "미리 정의된 CoroutineDispatcher - 1. Dispatchers.I O, Dispatchers.Default" 강의 중 마지막 부분에서 Dispatchers.IO 와 Dispatchers.Default가 사용하는 스레드의 이름이 동일한 이유는 공유 스레드풀 때문이라고 하셨는데, 이 부분이 이해가 잘 가지 않습니다. 이것이 중요한 이유가 각각의 Dispatcher가 사용하는 스레드가 실제로는 다름에도 불구하고, 이름은 동일하기 때문에 헷갈리면 안되기 때문인가요? 제가 강조하신 부분을 잘 이해한건지 모르겠습니다. 2) LimitedParallelism은 코루틴 사용 시 모든 부분에 적용해야 하는 것인가요? 아니면 특정 경우에만 사용하면 되는 것인가요? 3) Code3-1~3-4를 실행할 때 어떤 때는 스레드 이름이 DefaultDispatcher-worker-1,2,3으로 뜨지만 또 어떤 때는 1,2,1 또는 1,2,4 또는 1,2,5 이런식으로 뜨는데 이유가 무엇인가요? 감사합니다!
미해결
[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
BTS 강의 레이아웃에 사진삽입 6분 4초쯤 보고 있는데요, 알려주신대로 다음과 같이 코드를 입력하고 앱 구동을 눌렀는데 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_1" android:layout_width="120dp" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_2" android:layout_width="120dp" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_3" android:layout_width="120dp" android:layout_height="120dp"> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_4" android:layout_width="120dp" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_5" android:layout_width="120dp" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_6" android:layout_width="120dp" android:layout_height="120dp"> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="120dp"> <ImageView android:src="@drawable/bts_7" android:layout_width="120dp" android:layout_height="120dp"> </LinearLayout> </LinearLayout> 다음 문구와 같이 에러가 떠서 테스트 구동이 안됩니다. Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build .gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable 뭐가 잘못된건가요??
미해결
[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
강의 잘 보고 있습니다 다름이 아니라 로그인 로그아웃 버튼도 만들었고 수업에 나온 것처럼 똑같이 코드를 썼는데도 막상 작동하면 uid까진 출력되는데 문제는 1) 로그아웃 버튼을 누르면 null 메세지가 출력이 안 됩니다 2) 그렇다고 로그아웃 버튼을 누르고 로그인 되어있던 계정을 누르면 toast로 써둔 "로그인 성공"이라는 메세지가 안 뜸 일단 MainActivity.kt에 쓴 코드와 activity_main.xml에 쓴 코드를 올리겠습니다 //MainActivity.kt에 쓴 코드 package com.example.mysampleapp import com.example.mysampleapp.databinding.ActivityMainBinding import android.os.Bundle import android.widget.Button import android.widget.EditText import android.widget.Toast import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import androidx.databinding.DataBindingUtil import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.ktx.auth import com.google.firebase.ktx.Firebase class MainActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth private lateinit var binding : ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { // Initialize Firebase Auth auth = Firebase.auth super.onCreate(savedInstanceState) enableEdgeToEdge() setContentView(R.layout.activity_main) Toast.makeText(this, auth.currentUser?.uid.toString(),Toast.LENGTH_SHORT).show() binding = DataBindingUtil.setContentView(this, R.layout.activity_main) val joinBtnClicked = findViewById<Button>(R.id.joinBtn) joinBtnClicked.setOnClickListener { // 첫번째 방법 // val email = findViewById<EditText>(R.id.emailArea) // val pwd = findViewById<EditText>(R.id.pwdArea) //두번째 방법 val email = binding.emailArea val pwd = binding.pwdArea auth.createUserWithEmailAndPassword( email.text.toString(), pwd.text.toString() ) .addOnCompleteListener(this) { task -> if (task.isSuccessful) { Toast.makeText(this,"ok",Toast.LENGTH_SHORT).show() } else { Toast.makeText(this,"no",Toast.LENGTH_SHORT).show() } } binding.logoutBtn.setOnClickListener{ auth.signOut() Toast.makeText(this,auth.currentUser?.uid.toString(),Toast.LENGTH_SHORT).show() } binding.loginBtn.setOnClickListener{ val email = binding.emailArea val pwd = binding.pwdArea auth.signInWithEmailAndPassword( email.text.toString(), pwd.text.toString() ) .addOnCompleteListener(this) { task -> if (task.isSuccessful) { //성공하면 Toast.makeText(this, "로그인 성공", Toast.LENGTH_SHORT).show() //성공하면 UID 값을 띄워보자↓ Toast.makeText(this,auth.currentUser?.uid.toString(),Toast.LENGTH_SHORT).show() } else { //실패하면 Toast.makeText(this, "로그인 실패", Toast.LENGTH_SHORT).show() } } } } } } //activity_main.xml에 쓴 코드 <?xml version="1.0" encoding="utf-8"?> <layout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical"> <EditText android:id="@+id/emailArea" android:hint="email" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/pwdArea" android:hint="pwd" android:layout_width="match_parent" android:layout_height="wrap_content"/> <Button android:id="@+id/joinBtn" android:text="회원가입" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/logoutBtn" android:text="LOGOUT" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/loginBtn" android:text="LOGIN" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </layout> 긴 글 읽어주심에 감사합니다.... 😥 😥
미해결
[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
안녕하세요 코틀린강좌를 통해 안드로이드 앱 제작공부를 하고 있는 학생입니다. 다름이 아니라 완성된 앱을 갤럭시 안드로이드폰에 연결하는 작업까지 완료하고 실행하여 오류가 있는 부분을 찾던 중에 게시판에 만들었던 사진첨부 기능이 작동되지 않는것 같아서 문의차 커뮤니티에 올리게되었습니다. 위 사진 처럼 글만 입력이 되고 사진은 보이지 않아서 무슨 문제인지 알고 싶습니다! 코드는 강좌 그대로 사용했습니다!
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
강의를 보면 웹사이트에 접속을 했을 때 id가 가장 먼저 출력이 되는데 저는 id가 중간에 출력이 됩니다. 코드를 아무리 봐도 이유를 모르겠어서 질문 드립니다. 어느 부분의 코드를 봐야 위 내용을 수정할 수 있나요?
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
Engine running RAM 1.08 GB CPU --.-- % Disk --.-- GB avail. of --.-- GB BETA Terminal v4.34.3 (HTTP code 400) unexpected - invalid tag format 위와 같은 오류가 나는데 왜 그런 걸까요? 인텔리제이에서 빌드할 때도 문제가 없었습니다...
미해결
[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
<?xml version="1.0" encoding="utf-8"?> <layout> <LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#008000" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" android:layout_marginTop="100dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="30sp" android:gravity="center" android:textColor="@color/black" android:layout_margin="20dp" android:textStyle="bold" android:text="인생은 주사위 한방에 가는거 아니겠습니까?"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" android:weightSum="2"> <ImageView android:src="@drawable/dice_1" android:layout_width="120dp" android:layout_height="120dp" android:layout_weight="1"/> <ImageView android:src="@drawable/dice_2" android:layout_width="120dp" android:layout_height="120dp" android:layout_weight="1"/> </LinearLayout> <Button android:id="@+id/DiceStartBtn" android:text="인생 고고" android:layout_width="match_parent" android:background="#@color/black" android:textColor="@color/white" android:layout_height="50dp" android:layout_margin="50dp"/> </LinearLayout> </layout> xml 코드 import org.jetbrains.kotlin.storage.CacheResetOnProcessCanceled.enabled plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) } android { namespace = "com.seungwon.dice" compileSdk = 34 defaultConfig { applicationId = "com.seungwon.dice" minSdk = 24 targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } dataBinding{ enable=true } } dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) implementation(libs.material) implementation(libs.androidx.activity) implementation(libs.androidx.constraintlayout) testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) } gradle코드 문제 부분입니다
미해결
[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#008000" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" android:layout_marginTop="100dp" tools:ignore="MissingConstraints"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="30sp" android:gravity="center" android:textColor="@color/black" android:layout_margin="20dp" android:textStyle="bold" android:text="인생은 주사위 한방에 가는거 아니겠습니까?"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" tools:ignore="MissingConstraints"> <ImageView android:src="@drawable/dice_1" android:layout_width="120dp" android:layout_height="120dp"/> <ImageView android:src="@drawable/dice_2" android:layout_width="120dp" android:layout_height="120dp"/> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> 제대로 따라서 타이핑 한것 같은데 왜 그럴까요?
미해결
[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
현재 빌드 진행 중 이러한 오류가 발생합니다. 7 issues were found when checking AAR metadata: 1. Dependency 'androidx.appcompat:appcompat-resources:1.7.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 2. Dependency 'androidx.appcompat:appcompat:1.7.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 3. Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 4. Dependency 'androidx.core:core-ktx:1.13.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 5. Dependency 'androidx.transition:transition:1.5.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 6. Dependency 'androidx.core:core:1.13.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 7. Dependency 'androidx.annotation:annotation-experimental:1.4.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 이후 해결을 위해 build.gradle.kts 파일에서 compile, target Sdk를 모두 34로 올리고, dependencies { implementation("androidx.core:core-ktx:1.9.0") implementation("androidx.appcompat:appcompat:1.7.0") implementation("com.google.android.material:material:1.12.0") implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.databinding:databinding-runtime:8.7.0") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.2.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") } dependencies에서 core-ktx 버전을 1.9.0에서 1.13.1로 올렸습니다. 이후 빌드에서 오류가 발생하지 않는 걸 확인했습니다. 하지만 이후에도 run app이 불가능해서 앱을 확인할 수 없었습니다. 혹시 sdk 버전 올라가면서 변경할 점이 추가로 있다면 알려주실 수 있나요..
해결됨
코틀린 코루틴 완전 정복
안녕하세요, 해당 강의와 책을 통해 코루틴에 대한 학습을 진행하고 있는 학생입니다. 학습한 내용을 기술 블로그나 깃헙 등에 출처를 남기고 공개해도 되는지 궁금합니다! 요즘 강의와 책에 대한 저작권이 중요한 만큼, 강의자님께 직접 여쭙게 되었습니다. 좋은 강의 감사합니다.
해결됨
실전! 코틀린과 스프링 부트로 도서관리 애플리케이션 개발하기 (Java 프로젝트 리팩토링)
우선 완강을 앞두고 있는데 추가 강의가 정말 흥미롭고 재밌었습니다. 감사합니다! 질문으로 넘어가자면.. [질문1 - 강의 중 allopen 플러그인 사용 여부] 강의를 듣는 와중에 7:30초쯤 말씀에는 사용했다고 하셨지만 제가 강의를 따라가면 작성해온 프로젝트 코드 내에서는 allopen관련 plugin이 build.gradle에 없었습니다. 혹시나 해서 강의 초반 자료로 주셨던 library-app-complete.zip 파일 내 build.gradle을 열어보았지만 안적혀 있었고 혹시 자동으로 연관된 dependency가 설치되었나 싶었지만 allopen을 검색해보았을때 찾기 못했습니다. 해당 플러그인이 사용안했던 것이 맞는지 궁금합니다! [질문2 - allopen 플러그인이 없어도 되었던 이유] 이게 없어도 프로젝트가 잘 작동한 이유가 Entity 클래스는 org.jetbrains.kotlin.plugin.spring 플러그인이 open 시켜주고 MappedSuperclass나 Embeddable 클래스는 강의 중 사용한 적이 없었기 때문에 몰랐다고 보는게 맞는건지도 궁금합니다! [강의 중 나온 allopen 플러그인 적용 코드 예시] id 'org.jetbrains.kotlin.plugin.allopen' version '1.6.21' allOpen { annotation("javax.persistence.Entity") annotation("javax.persistence.MappedSuperclass") annotation("javax.persistence.Embeddable") }
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
++++ 테스트파일에서 오타가 난 줄 알았는데 레포지토리 파일 모두 오타가 나있었네요!! 감사합니다!
미해결
[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
image1.setOnClickListener { } 여기서 괄호에 엔터 치시면 it: view! 가 회색으로 바뀌시던대 저는 엔터쳐도 아무 반응이 아무것도 안뜨네요 .. 제가 임의로 it: view!를 쳐넣어도 회색으로 바뀌지도 않고요.. 어찌해야하나요
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
projectRepositoryTest.kt 파일을 아래와 같이 작성했는데 assertion 오류가 나서 원인을 모르겠어서 해당 파일 코드 첨부합니다. 94줄과 111줄 오류인 걸로 보아 skills를 assert할 때 뭐가 잘못된 것 같은데 어떻게 고쳐야 하는지 잘 모르겠습니다..! package com.yewon.portfolio.domain.repository import com.yewon.portfolio.domain.constant.SkillType import com.yewon.portfolio.domain.entity.Project import com.yewon.portfolio.domain.entity.ProjectDetail import com.yewon.portfolio.domain.entity.ProjectSkill import com.yewon.portfolio.domain.entity.Skill import org.assertj.core.api.Assertions import org.assertj.core.api.Assertions.* //import com.yewon.portfolio.domain.entity.* //import org.assertj.core.api.Assertions.* import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest @DataJpaTest @TestInstance(TestInstance.Lifecycle.PER_CLASS) class ProjectRepositoryTest( @Autowired val projectRepository: ProjectRepository, @Autowired val skillRepository: SkillRepository ) { val DATA_SIZE = 10 private fun createProject(n: Int): Project { val project = Project( name = "${n}", description = "테스트 설명 {n}", startYear = 2023, startMonth = 9, endYear = 2023, endMonth = 9, isActive = true ) val details = mutableListOf<ProjectDetail>() for (i in 1..n) { val projectDetail = ProjectDetail(content = "테스트 ${i}", url = null, isActive = true) details.add(projectDetail) } project.addDetails(details) val skills = skillRepository.findAll() val skillsUsedInProject = skills.subList(0, n) for (skill in skillsUsedInProject) { val projectSkill = ProjectSkill(project = project, skill = skill) project.skills.add(projectSkill) } return project } @BeforeAll fun beforeAll() { println("----- 스킬 데이터 초기화 시작 -----") val skills = mutableListOf<Skill>() for (i in 1..DATA_SIZE) { val skillTypes = SkillType.values() val skill = Skill(name = "테스트 ${i}", type = skillTypes[i%skillTypes.size].name, isActive = true) skills.add(skill) } skillRepository.saveAll(skills) println("----- 스킬 데이터 초기화 종료 -----") // println("----- 데이터 초기화 이전 조회 시작 -----") // val beforeInsert = projectRepository.findAll() // assertThat(beforeInsert).hasSize(0) // println("----- 데이터 초기화 이전 조회 종료 -----") println("----- 테스트 데이터 초기화 시작 -----") val projects = mutableListOf<Project>() for (i in 1..DATA_SIZE) { val project = createProject(i) projects.add(project) } projectRepository.saveAll(projects) println("----- 테스트 데이터 초기화 종료 -----") } @Test fun testFindAll() { println("----- findAll 테스트 시작 -----") val projects = projectRepository.findAll() assertThat(projects).hasSize(DATA_SIZE) println("projects.size: ${projects.size}") for (project in projects) { assertThat(project.details).hasSize(project.name.toInt()) println("project.details.size: ${project.details.size}") assertThat(project.skills).hasSize(project.name.toInt()) println("project.skills.size: ${project.skills.size}") } println("----- findAll 테스트 종료 -----") } @Test fun testFindAllByIsActive() { println("----- findAllByIsActive 테스트 시작 -----") val projects = projectRepository.findAllByIsActive(true) assertThat(projects).hasSize(DATA_SIZE) println("projects.size: ${projects.size}") for (project in projects) { assertThat(project.details).hasSize(project.name.toInt()) println("project.details.size: ${project.details.size}") assertThat(project.skills).hasSize(project.name.toInt()) println("project.skills.size: ${project.skills.size}") } println("----- findAllByIsActive 테스트 종료 -----") } }
해결됨
입문자를 위한 Spring Boot with Kotlin - 나만의 포트폴리오 사이트 만들기
현재 강의는 ExperienceRepository코드를 테스트하는 코드인데 interface HttpInterfaceRepository : JpaRepository<HttpInterface, Long>{ fun countAllByCreatedDateTimeBetween(start: LocalDateTime, end: LocalDateTime): Long } 제가 이런식으로 HttpInterfaceRepoistory에 사용자 정의 메서드이름을 잘못 설정했어서 테스트 코드 실행중에 오류가 발생하여 이런식으로 실행이 안되었습니다. HttpInterfaceRepository와 관려 없는 코드 같은데 왜 오류가 발생하는 건가요? 그리고 저 오류를 발견해서 HttpInterfaceRepository 를 수정하고 실행을 하니 정상적으로 실행은 되었는데 이 경고가 뜹니다 이건 어떤건가요? 프로젝트 리포지토리 테스트가 계속 실패하는데 왜 그런건가요? https://drive.google.com/file/d/1s2JngsdGhN_iOUf6llkkcUwwISIuCTUp/view?usp=sharing 구글 드라이브에 소스코드 압축해서 업로드 했습니다
미해결
[중급편] 코인 가격 모니터링 앱 제작 (Android Kotlin)
에러재현 Intro를 통해서 DB를 최초 저장하는 것은 성공 앱을 재빌드 또는 재실행하면 App Inspection 의 coin_database (closed) 라고 나오는 현상 있음 Database Inspector 관련 에러창도 뜹니다. 시도해본 에러 처리 시뮬레이터 디바이스 변경 시뮬레이터 디바이스 wipe data 실기기에서 [에러재현]과 동일한 방식의 빌드테스트 App Inspector의 [Keep Data Connections Open] 활성화 [프로젝트파일 구글드라이브 링크] https://drive.google.com/file/d/1a7nJ6Zik7Plpx2UEs7nBKDemQ40qZvpJ/view?usp=sharing 왠만하면 검색하여 해결해보려했는데 도저히 이유를 모르겠네요.. 혹시 어떤 문제인지 알고 계신가요?
미해결
자바 개발자를 위한 코틀린 입문(Java to Kotlin Starter Guide)
코틀린으로 스프링을 개발해 보고 있습니다. 리턴할떄 ResponseEntity<Any> 이런식으로 Any를 사용해도 괜찮을까요?
해결됨
코틀린 코루틴 완전 정복
안녕하세요 Coroutine 강의 잘듣고있는 수강생입니다 (_ _) 최근 JDK21의 VirtualThread관련해 찾아보게 되었는데요 Coroutine과 유사하게 Os단의 Thread를 점유하지 않고 Software적으로(?) 쓰레드에 작업분배를 하는점이 유사하다고 느꼈습니다 (잘못이해했다면 첨삭부탁드립니다 ㅠㅠ) 만약 제 이해가 맞다면, JVM레벨에서 제공하게되는 VirtualThread가 더 범용성이 높아보이는데 Coroutine의 사용이 유지가 될까요? 남아있게 된다면 Kotlin 언어차원에서의 사용성이 좋아서 일정도일지... 아니면 Coroutine이 VirtualThread와 다르게 차별화된 장점이 있을지 궁금합니다 감사합니다!