Skip to content

Instantly share code, notes, and snippets.

View devsejong's full-sized avatar
💭
I may be slow to respond.

Sejong Park devsejong

💭
I may be slow to respond.
View GitHub Profile
@devsejong
devsejong / build.gradle
Last active March 31, 2019 14:33
spring + jpa(with querydsl) + submodule + lombok
plugins {
id "org.springframework.boot" version "2.1.3.RELEASE" apply false
id "io.spring.dependency-management" version "1.0.6.RELEASE" apply false
}
def querydslProjects = [project(':domains')]
configure(subprojects) {
apply plugin: "java"
apply plugin: "org.springframework.boot"
public class JarResourceWalkerTest {
@Test
public void test1234() throws Exception {
walk("/org/springframework");
}
private static ConcurrentMap<String, Object> locks = new ConcurrentHashMap<>();
public void walk(String path) throws Exception {
@devsejong
devsejong / AesEncodingDecodingTest.java
Last active June 14, 2017 04:43
뭔진모르겠지만암호화
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.Key;
import java.security.SecureRandom;
/**
* Created by sjpark on 2017-05-03.
@devsejong
devsejong / DtoDiffTest.java
Last active February 21, 2017 07:50
두개의 DTO를 비교해 변경된 값이 있을경우 해당 값을 반환합니다.
import org.junit.Test;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
public class DtoDiffTest {
@Test
public interface EnumMatchable<T extends Enum<T>> {
default boolean contains(Enum<T>... elements){
if(elements.length == 0){
throw new IllegalArgumentException("하나 이상의 elements가 입력되어야 합니다.");
}
for (Enum<T> element : elements) {
if(element == this){
return true;
@devsejong
devsejong / MapInitializerTest.java
Created December 9, 2016 07:23
맵을 선언과 동시에 초기화하기
// http://minborgsjavapot.blogspot.kr/2014/12/java-8-initializing-maps-in-smartest-way.html
public class MapInitializerTest {
public static <K, V> Map.Entry<K, V> entry(K key, V value) {
return new AbstractMap.SimpleEntry<>(key, value);
}
public static <K, U> Collector<Map.Entry<K, U>, ?, Map<K, U>> entriesToMap() {
return Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue);
package com.encar.api.pay.common.util;
import com.encar.api.pay.common.except.PaymentException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@devsejong
devsejong / Problem.java
Created November 2, 2016 04:26
정근이형의 숙제!
public class Problem1 {
@Test
public void simpleTest(){
System.out.println(action(100));
System.out.println(action(194));
System.out.println(action(3142));
@devsejong
devsejong / gist:38f907782ec3946aa8964d8ea9222500
Created September 29, 2016 09:11
DiscriminatorValue 를 모델에서 가져오는 방법
public String getDiscriminatorValue(){
DiscriminatorValue val = this.getClass().getAnnotation( DiscriminatorValue.class );
return val == null ? null : val.value();
}
@devsejong
devsejong / AsciiTable4J.java
Created August 21, 2016 11:53
아스키테이블 생성하기
import java.lang.Character.UnicodeScript;
import java.util.ArrayList;
import java.util.List;
import static java.lang.Character.UnicodeScript.HANGUL;
/**
* Create asciiTable for java
*
* <pre>