Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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;
import java.util.concurrent.Executors;

@Configuration
@EnableAsync
public class AsyncConfig extends AsyncConfigurerSupport {
public class AsyncConfig implements AsyncConfigurer {

@Override
public Executor getAsyncExecutor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@ class PasswordChangingServiceTest {
@Autowired
private MemberRepository repository;

@MockBean
@MockitoBean
private SendService sendService;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,7 +28,7 @@ public class UserControllerTest {
@Autowired
private ObjectMapper objectMapper;

@MockBean
@MockitoBean
private UserRepository repository;

@Test
Expand Down
2 changes: 1 addition & 1 deletion SpringBootLogStash/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>./log/log-%d{yyyy-MM-dd}-(%i).json</fileNamePattern>
<maxHistory>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFileNamingAndTriggeringPolicy">
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import java.io.Serializable;

Expand All @@ -15,7 +14,6 @@
public class Notice implements Serializable {

@Id
@GeneratedValue
private Long idx;
private String title;

Expand Down
4 changes: 2 additions & 2 deletions SpringBootTest/src/test/java/com/example/MockMvcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@ public class MockMvcTest {
@Autowired
private MockMvc mvc;

@MockBean
@MockitoBean
private BasicService service;

@Autowired
Expand Down
4 changes: 2 additions & 2 deletions SpringBootTest/src/test/java/com/example/MockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -17,7 +17,7 @@ public class MockTest {
@Autowired
TestRestTemplate restTemplate;

@MockBean
@MockitoBean
BasicService service;

@Test
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -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"
})
Expand Down
Loading