This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.random.Random.Default.nextInt | |
fun main(args: Array<String>) { | |
val trialCount = 5 | |
randomPrint(trialCount) | |
} | |
fun randomPrint(trialCount: Int) { | |
repeat(trialCount) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class GlobalErrorWebExceptionHandler implements ErrorWebExceptionHandler { | |
@Override | |
public Mono<Void> handle(ServerWebExchange serverWebExchange, Throwable throwable) { | |
ErrorAttribute errorAttribute = this.buildResponse(throwable); | |
serverWebExchange.getResponse().setStatusCode(errorAttribute.getStatus()); | |
serverWebExchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ErrorResponseResolver { | |
public <T extends Throwable> void test(T t) | |
throws InvocationTargetException, IllegalAccessException { | |
Method[] methods = getClass().getDeclaredMethods(); | |
for (Method method : methods) { | |
String clazzName = t.getClass().getName(); | |
if (clazzName.equals(method.getParameterTypes()[0].getName())) { | |
method.invoke(t, t); // 실행한다! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public AService { | |
@Autowired private ARepository repository; | |
@Transactional | |
public void save(A a) { | |
repository.save(a); | |
// update(a); // update 트랜잭션 적용안됨 XXX | |
} | |
@Trnasaction(propagation = Propagation.REQURIES_NEW) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class KubernetesLables { | |
@JsonProperty("beta.kubernetes.io/arch") | |
private String betaArch; | |
@JsonProperty("beta.kubernetes.io/os") | |
private String betaOs; | |
@JsonProperty("kubernetes.io/arch") | |
private String arch; | |
@JsonProperty("kubernetes.io/hostname") | |
private String hostname; | |
@JsonProperty("kubernetes.io/os") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class AService { | |
@Autowired | |
private BService bService; | |
public void doSomething() { | |
bService.doSomething(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Inject | |
private RedissonClient redissonClient; | |
private Exception exception; | |
private final CountDownLatch latch = new CountDownLatch(2); | |
@Test | |
public void syncTest() { | |
List<Thread> threads = IntStream.range(0, 2) | |
.mapToObj(i -> new Thread1()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Goods { | |
private int goodsId; | |
} | |
@Entity | |
public class GoodsDetail { | |
private Assertion<Goods> goodsId; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.benx.weply.core.spring.jpa; | |
import com.benx.weply.core.SpringTest; | |
import com.benx.weply.core.domain.enums.Shop; | |
import com.benx.weply.core.domain.user.User; | |
import com.benx.weply.core.domain.user.UserService; | |
import lombok.extern.slf4j.Slf4j; | |
import org.hibernate.StaleObjectStateException; | |
import org.junit.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import javax.persistence.EntityManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.crypto.Mac | |
import javax.crypto.spec.SecretKeySpec | |
import kotlin.experimental.and | |
fun main(args: Array<String>) { | |
val hmacFromKomoju = "06cb40bd7c630613e41f874296eddd0153d023857a76a9de52daad5da6c2bbe4" | |
val algorithm = "HmacSHA256" |
NewerOlder