Skip to content

Instantly share code, notes, and snippets.

View syakuis's full-sized avatar
🏃‍♂️
I may be slow to respond.

샤쿠 syakuis

🏃‍♂️
I may be slow to respond.
View GitHub Profile
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.IOException;
@syakuis
syakuis / ClassesInfoTest.java
Last active April 5, 2022 01:58
Reflect classes information
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
@syakuis
syakuis / memo.md
Created January 20, 2022 01:27
자바 위치 찾기
which java
ls -al path

Brew

/usr/libexec/java_home -V
@syakuis
syakuis / parameter_querystring_converter.java
Last active October 31, 2021 10:13
querystring to map parameters and map parameters to querystring
package io.github.syakuis.oauth2.authorization.security.endpoint;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.*;
@syakuis
syakuis / DataInitializationConfiguration.java
Last active May 23, 2019 11:18
spring data jpa, db 데이터 초기화 여러 방법
@Configuration
public class DataInitializationConfiguration {
@Bean
public Jackson2RepositoryPopulatorFactoryBean repositoryPopulator() {
Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
factory.setResources(new Resource[] { new ClassPathResource("LocalWebUser.json"), new ClassPathResource("Role.json") });
return factory;
}
}
@syakuis
syakuis / error.md
Last active May 17, 2019 14:15
Spring data jpa 밴더 Hibernate 5 사용시 List 결과를 Spring MVC Jackson json 으로 직렬화하지 못하는 경우

1차 오류

org.springframework.orm.jpa.JpaSystemException: HHH000142: Bytecode enhancement failed: .LocalWebUserEntity; nested exception is org.hibernate.HibernateException: HHH000142: Bytecode enhancement failed: .web.localweb.domain.LocalWebUserEntity

원인: constructor 가 private 여서 발생한 문제.

해결

create table oauth_client_details (
client_id VARCHAR(255) PRIMARY KEY,
resource_ids VARCHAR(255),
client_secret VARCHAR(255),
scope VARCHAR(255),
authorized_grant_types VARCHAR(255),
web_server_redirect_uri VARCHAR(255),
authorities VARCHAR(255),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@syakuis
syakuis / docker-compose.yml
Created April 7, 2019 15:49
rabbitmq docker compose
version: '3'
services:
rabbitmq:
image: 'rabbitmq:3-management'
container_name: 'rabbitmq'
hostname: 'rabbitmq'
ports:
- '15672:15672'
- '5672:5672'
@syakuis
syakuis / FlywayConfig.java
Created March 20, 2019 07:33
DB 서버에 접속하지 못하면 특정 시간이후에 flyway 를 다시 시작하도록 작업
import lombok.extern.slf4j.Slf4j;
import org.flywaydb.core.internal.dbsupport.FlywaySqlException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
@syakuis
syakuis / build.groovy
Created February 7, 2019 10:43
jenkins pipeline groovy script (with telegram)
def failureReport = { text -> "\r\n------------ Finish Report ------------\r\n${text}------------ Finish Report Report ------------\r\n" }
def botUrl = "https://api.telegram.org/bot${env.BOT_TOKEN}/sendMessage"
def bot = { text -> sh "curl -s -X POST ${botUrl} -d chat_id=${env.BOT_CHAT_ID} -d text='#${env.BUILD_ID} ${text}'" }
node {
bot("build starting")
def mvnHome
stage('Preparation') {
if (env.USE_GIT_PULL == "true") {