From eb8db664c0870b37c80335dae8ca292f032ac0fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 05:10:16 +0000 Subject: [PATCH 1/4] build(deps): bump org.springframework.boot from 3.3.3 to 3.4.1 Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 3.3.3 to 3.4.1. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.3.3...v3.4.1) --- updated-dependencies: - dependency-name: org.springframework.boot dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 3d95adc8..fffe48b0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,7 @@ pluginManagement { plugins { id 'io.spring.dependency-management' version "1.1.6" - id 'org.springframework.boot' version "3.3.3" + id 'org.springframework.boot' version "3.4.1" ['jvm', 'plugin.spring', 'plugin.jpa'].forEach(postfix -> { id "org.jetbrains.kotlin.${postfix}" version "1.8.0" }) From 2046ec7db81e3da1206e00cfb2e45a7642491cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=97=88=EC=9B=90=EC=B2=A0/NSC=EC=84=9C=EB=B2=84=ED=8C=80?= =?UTF-8?q?/NE?= Date: Sat, 21 Dec 2024 14:47:24 +0900 Subject: [PATCH 2/4] fix compile --- .../main/java/com/example/java/config/AsyncConfig.java | 4 ++-- .../main/kotlin/com/example/kotlin/config/AsyncConfig.kt | 5 ++--- .../com/example/java/component/EncodedJsonComponent.java | 8 +++++--- .../com/example/kotlin/component/EncodedJsonComponent.kt | 6 +++--- .../test/java/com/heowc/PasswordChangingServiceTest.java | 4 ++-- .../src/test/java/com/example/web/UserControllerTest.java | 5 ++--- SpringBootTest/src/test/java/com/example/MockMvcTest.java | 4 ++-- SpringBootTest/src/test/java/com/example/MockTest.java | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/SpringBootAsync/src/main/java/com/example/java/config/AsyncConfig.java b/SpringBootAsync/src/main/java/com/example/java/config/AsyncConfig.java index 52a9432e..f92cf984 100644 --- a/SpringBootAsync/src/main/java/com/example/java/config/AsyncConfig.java +++ b/SpringBootAsync/src/main/java/com/example/java/config/AsyncConfig.java @@ -1,7 +1,7 @@ package com.example.java.config; import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.AsyncConfigurerSupport; +import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import java.util.concurrent.Executor; @@ -9,7 +9,7 @@ @Configuration @EnableAsync -public class AsyncConfig extends AsyncConfigurerSupport { +public class AsyncConfig implements AsyncConfigurer { @Override public Executor getAsyncExecutor() { diff --git a/SpringBootAsync/src/main/kotlin/com/example/kotlin/config/AsyncConfig.kt b/SpringBootAsync/src/main/kotlin/com/example/kotlin/config/AsyncConfig.kt index 9eb87ea8..99439ad5 100644 --- a/SpringBootAsync/src/main/kotlin/com/example/kotlin/config/AsyncConfig.kt +++ b/SpringBootAsync/src/main/kotlin/com/example/kotlin/config/AsyncConfig.kt @@ -1,15 +1,14 @@ package com.example.kotlin.config import org.springframework.context.annotation.Configuration -import org.springframework.scheduling.annotation.AsyncConfigurerSupport +import org.springframework.scheduling.annotation.AsyncConfigurer import org.springframework.scheduling.annotation.EnableAsync - import java.util.concurrent.Executor import java.util.concurrent.Executors @Configuration @EnableAsync -class AsyncConfig : AsyncConfigurerSupport() { +class AsyncConfig : AsyncConfigurer { override fun getAsyncExecutor(): Executor { // ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); diff --git a/SpringBootCustomJackson/src/main/java/com/example/java/component/EncodedJsonComponent.java b/SpringBootCustomJackson/src/main/java/com/example/java/component/EncodedJsonComponent.java index 3ed28a8a..b8284a8f 100644 --- a/SpringBootCustomJackson/src/main/java/com/example/java/component/EncodedJsonComponent.java +++ b/SpringBootCustomJackson/src/main/java/com/example/java/component/EncodedJsonComponent.java @@ -6,9 +6,10 @@ import com.fasterxml.jackson.core.ObjectCodec; import com.fasterxml.jackson.databind.*; import org.springframework.boot.jackson.JsonComponent; -import org.springframework.util.Base64Utils; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.Iterator; @JsonComponent @@ -33,7 +34,8 @@ public Model deserialize(JsonParser p, DeserializationContext ctxt) System.out.println(field + ":" + node.get(field)); } - String name = new String(Base64Utils.decodeFromString(node.get("name").asText())); + String name = new String(Base64.getDecoder().decode(node.get("name").asText()), + StandardCharsets.UTF_8); int type = node.get("type").asInt(); System.out.println("---------------------------------------------------"); return new Model(name, type); @@ -52,7 +54,7 @@ public void serialize(Model value, JsonGenerator json, SerializerProvider provider) throws IOException { json.writeStartObject(); json.writeFieldName("name"); - json.writeString(Base64Utils.encodeToString(value.getName().getBytes())); + json.writeString(Base64.getEncoder().encodeToString(value.getName().getBytes())); json.writeFieldName("type"); json.writeNumber(value.getType()); json.writeEndObject(); diff --git a/SpringBootCustomJackson/src/main/kotlin/com/example/kotlin/component/EncodedJsonComponent.kt b/SpringBootCustomJackson/src/main/kotlin/com/example/kotlin/component/EncodedJsonComponent.kt index 5a8ab0dd..dfb6c908 100644 --- a/SpringBootCustomJackson/src/main/kotlin/com/example/kotlin/component/EncodedJsonComponent.kt +++ b/SpringBootCustomJackson/src/main/kotlin/com/example/kotlin/component/EncodedJsonComponent.kt @@ -5,8 +5,8 @@ import com.fasterxml.jackson.core.JsonGenerator import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.* import org.springframework.boot.jackson.JsonComponent -import org.springframework.util.Base64Utils import java.io.IOException +import java.util.Base64 @JsonComponent class EncodedJsonComponent { @@ -28,7 +28,7 @@ class EncodedJsonComponent { println(field + ":" + node.get(field)) } - val name = String(Base64Utils.decodeFromString(node.get("name").asText())) + val name = String(Base64.getDecoder().decode(node.get("name").asText())) val type = node.get("type").asInt() println("---------------------------------------------------") return Model(name, type) @@ -46,7 +46,7 @@ class EncodedJsonComponent { provider: SerializerProvider) { json.writeStartObject() json.writeFieldName("name") - json.writeString(Base64Utils.encodeToString(value.name.toByteArray())) + json.writeString(Base64.getEncoder().encodeToString(value.name.toByteArray())) json.writeFieldName("type") json.writeNumber(value.type) json.writeEndObject() diff --git a/SpringBootEvent/src/test/java/com/heowc/PasswordChangingServiceTest.java b/SpringBootEvent/src/test/java/com/heowc/PasswordChangingServiceTest.java index 1df25879..d60efb32 100644 --- a/SpringBootEvent/src/test/java/com/heowc/PasswordChangingServiceTest.java +++ b/SpringBootEvent/src/test/java/com/heowc/PasswordChangingServiceTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import static com.heowc.event.PasswordChangedEventListener.MESSAGE_FORMAT; import static org.assertj.core.api.Assertions.assertThat; @@ -22,7 +22,7 @@ class PasswordChangingServiceTest { @Autowired private MemberRepository repository; - @MockBean + @MockitoBean private SendService sendService; @Test diff --git a/SpringBootJpaSecurity/src/test/java/com/example/web/UserControllerTest.java b/SpringBootJpaSecurity/src/test/java/com/example/web/UserControllerTest.java index a5c41387..eda8bf30 100644 --- a/SpringBootJpaSecurity/src/test/java/com/example/web/UserControllerTest.java +++ b/SpringBootJpaSecurity/src/test/java/com/example/web/UserControllerTest.java @@ -7,11 +7,10 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; -import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import static org.assertj.core.api.Assertions.assertThat; @@ -29,7 +28,7 @@ public class UserControllerTest { @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private UserRepository repository; @Test diff --git a/SpringBootTest/src/test/java/com/example/MockMvcTest.java b/SpringBootTest/src/test/java/com/example/MockMvcTest.java index b081da9c..df8ddfcc 100644 --- a/SpringBootTest/src/test/java/com/example/MockMvcTest.java +++ b/SpringBootTest/src/test/java/com/example/MockMvcTest.java @@ -7,8 +7,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import static org.mockito.BDDMockito.given; @@ -22,7 +22,7 @@ public class MockMvcTest { @Autowired private MockMvc mvc; - @MockBean + @MockitoBean private BasicService service; @Autowired diff --git a/SpringBootTest/src/test/java/com/example/MockTest.java b/SpringBootTest/src/test/java/com/example/MockTest.java index 9fecddf1..d80f8bb1 100644 --- a/SpringBootTest/src/test/java/com/example/MockTest.java +++ b/SpringBootTest/src/test/java/com/example/MockTest.java @@ -5,8 +5,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; @@ -17,7 +17,7 @@ public class MockTest { @Autowired TestRestTemplate restTemplate; - @MockBean + @MockitoBean BasicService service; @Test From e7b4aea733ead040ffebf485d83e1751f38d1f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=97=88=EC=9B=90=EC=B2=A0/NSC=EC=84=9C=EB=B2=84=ED=8C=80?= =?UTF-8?q?/NE?= Date: Sat, 21 Dec 2024 15:00:29 +0900 Subject: [PATCH 3/4] See https://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy --- SpringBootLogStash/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpringBootLogStash/src/main/resources/logback-spring.xml b/SpringBootLogStash/src/main/resources/logback-spring.xml index 68bdeb52..4c5e2bc3 100644 --- a/SpringBootLogStash/src/main/resources/logback-spring.xml +++ b/SpringBootLogStash/src/main/resources/logback-spring.xml @@ -28,7 +28,7 @@ ./log/log-%d{yyyy-MM-dd}-(%i).json 30 - + 50MB From 2d5df9c145edbe817eae9fdaed2c293150627962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=97=88=EC=9B=90=EC=B2=A0/NSC=EC=84=9C=EB=B2=84=ED=8C=80?= =?UTF-8?q?/NE?= Date: Sat, 21 Dec 2024 15:11:29 +0900 Subject: [PATCH 4/4] fix test --- .../java/com/tistory/heowc/component/InitRunner.java | 11 ++++++----- .../main/java/com/tistory/heowc/domain/Notice.java | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/SpringBootNotice/src/main/java/com/tistory/heowc/component/InitRunner.java b/SpringBootNotice/src/main/java/com/tistory/heowc/component/InitRunner.java index f096e97c..7b4b1f4a 100644 --- a/SpringBootNotice/src/main/java/com/tistory/heowc/component/InitRunner.java +++ b/SpringBootNotice/src/main/java/com/tistory/heowc/component/InitRunner.java @@ -11,13 +11,14 @@ @Component @Transactional public class InitRunner implements ApplicationRunner { - - @Autowired NoticeRepository repository; - + + @Autowired + private NoticeRepository repository; + @Override public void run(ApplicationArguments args) throws Exception { - for (int i = 0; i < 50; i++) { - repository.save(new Notice((long) i, "title " + i, "content " + i)); + for (long i = 0; i < 50; i++) { + repository.save(new Notice(i, "title " + i, "content " + i)); } } } diff --git a/SpringBootNotice/src/main/java/com/tistory/heowc/domain/Notice.java b/SpringBootNotice/src/main/java/com/tistory/heowc/domain/Notice.java index cd641061..e355e3cd 100644 --- a/SpringBootNotice/src/main/java/com/tistory/heowc/domain/Notice.java +++ b/SpringBootNotice/src/main/java/com/tistory/heowc/domain/Notice.java @@ -5,7 +5,6 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import java.io.Serializable; @@ -15,7 +14,6 @@ public class Notice implements Serializable { @Id - @GeneratedValue private Long idx; private String title;