Skip to content

Instantly share code, notes, and snippets.

View ihoneymon's full-sized avatar

Kim Ji-Heon ihoneymon

View GitHub Profile

[java] StringJoiner 활용기

자바로 코딩을 하다보면 문자열 중간에 - 혹은 , 등을 넣어야 할 때가 있다. 이때 쉽게 할 수 있는 방법으로 다음과 같은 방식을 사용하곤 했다.

@Test
@ihoneymon
ihoneymon / 20180321-java-next-by-fupfin.asc
Last active June 29, 2018 06:08
Java 의 다음행보(next)는 Openjdk 에서 다루는 프로젝트에서 엿볼 수 있다.
@ihoneymon
ihoneymon / 20180312-springboot-exitcodegenerator.asc
Last active March 12, 2018 14:03
ExitCodeGenerator, 스프링 부트 애플리케이션을 깔끔하게 종료하며 내뱉을 종료코드

ExitCodeGenerator에 관한 이야기

애플리케이션이 정상적으로 종료되는 것은 꽤 중요하다. 애플리케이션의 갑작스런 죽음과는 달리 특정 상황이 발생했고 그 상황에 맞춰 종료코드를 반환하고 죽는다면 그에 대한 대응하기가 수월해진다. 스프링 부트에서 장애대응을 수월하게 할 수 있도록 특정상황에 따른 종료코드(Exit Code)를 반환하며 애플리케이션을 정상종료 시키는 기능을 제공한다.

@ihoneymon
ihoneymon / SpringSecurity5DelegatingPasswordTest.java
Created February 12, 2018 04:38
Spring Security5 add DelegatingPasswordEncoder test code
import org.junit.Before;
import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.*;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
@ihoneymon
ihoneymon / java_uuid_version.asc
Created February 10, 2018 15:09
아무런 생각없이 사용했던 UUID에는 4가지 형태의 UUID가 있었다.
/**
 * The version number associated with this {@code UUID}.  The version
 * number describes how this {@code UUID} was generated.
 *
 * The version number has the following meaning:
 * <ul>
 * <li>1    Time-based UUID
 * <li>2    DCE security UUID
@ihoneymon
ihoneymon / TestConfigurationTest.java
Created January 9, 2018 13:22
`@TestConfiguration` 를 테스트를 위한 내부 클래스로 선언한 예제
```
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestConfigurationTest {
@TestConfiguration
static class InnerTestConfig {
@Bean
RestTemplate restTemplate() {
@ihoneymon
ihoneymon / pom.xml
Created November 17, 2017 02:25
provided tomcat(embedded servlet container)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.honeymon.springboot.boot</groupId>
<artifactId>boot-spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
@ihoneymon
ihoneymon / build.gradle
Last active November 17, 2017 02:17
providedRuntime tomcat
// `build.gradle` for `boot-spring-boot`
plugins {
id 'java'
id 'war'
id 'eclipse'
id 'idea'
id 'org.springframework.boot' version '1.5.8.RELEASE'
id "com.gorylenko.gradle-git-properties" version "1.4.17"
}
@ihoneymon
ihoneymon / 20171103_flyway_intro_script.asc
Last active January 8, 2023 07:14
Flyway 소개영상을 위한 스크립트

Flyway 기능소개

준비

  • 스프링 부트에서 다음 의존성을 추가한다.

build.gradle
@ihoneymon
ihoneymon / 20171031_ksug_serverless.asc
Last active March 7, 2023 16:31
Dave syer@Spring I/O 2017 에서 발표한 "The Road to Serverless: Functions as Applications" 에 대한 내용정리

The Road to Serverless: Functions as Applications Review