Skip to content

Instantly share code, notes, and snippets.

Joseph Yoon cooljoseph

Block or report user

Report or block cooljoseph

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View emacs lisp
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
View CircuitBreaker.java
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CircuitBreaker {
}
@cooljoseph
cooljoseph / MyApp.py
Last active Apr 20, 2016
Flask 첫 코드
View MyApp.py
# -*- coding:utf-8 -*-
## 한글 사용을 위함
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "안녕하세요 Flask"
View batch.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<job id="test.job" parent="common.test.job" xmlns="http://www.springframework.org/schema/batch">
<step id="test.job.step" parent="common.test.step">
<tasklet>
View TestItemReader.java
package kr.sidnancy81.reader.test;
// apache lang 관련 패키지 import 문 생략
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;
@cooljoseph
cooljoseph / Result.txt
Created Feb 4, 2014
MultiRoutingDataSource Test 코드
View Result.txt
결과
2012-03-14 17:27:24 DEBUG [PROFILE:57] – +–>[SERVICE_S] UserReviewService.getTotalCountOfUserReview()
2012-03-14 17:27:24 DEBUG [PROFILE:77] – DataSource ===> DIST_READ
View applicationContext.xml
<aop:aspectj-autoproxy proxy-target-class=”true” />
<!– @Service단에서 Transaction 처리도 함께 해주기 위해 transaction manager의 order는 2로 내려준다. –>
<tx:annotation-driven proxy-target-class=”true” order=”2″/>
@cooljoseph
cooljoseph / ExecutionLoggingAspect.java
Created Feb 4, 2014
AOP로 DataSource 판단을 한다.
View ExecutionLoggingAspect.java
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Collection;
import java.util.Iterator;
import kr.sidnancy.annotation.DataSource;
import kr.sidnancy.common.inf.datasource.ContextHolder;
import kr.sidnancy.common.type.DataSourceType;
import org.aspectj.lang.ProceedingJoinPoint;
@cooljoseph
cooljoseph / applicationContext.xml
Created Feb 4, 2014
DataSource가 RoutingDataSource에서 판단되는 값에 따라 설정될 수 있도록 아래와 같이 Context 설정을 해준다.
View applicationContext.xml
<bean id=”dataSource” class=”kr.sidnancy.common.inf.datasource.RoutingDataSource”>
<property name=”targetDataSources”>
<map key-type=”kr.sidnancy.common.type.DataSourceType”>
<entry key=”MASTER” value-ref=”primaryDataSource” />
<entry key=”SLAVE” value-ref=”standbyDataSource” />
<entry key=”DIST_READ” value-ref=”distReadDataSource”/>
<entry key=”DIST_WRITE” value-ref=”distWriteDataSource”/>
</map>
</property>
<!– Default DataSource –>
@cooljoseph
cooljoseph / DataSource.java
Last active Aug 29, 2015
enum 으로 DataSource 별 Type을 셋팅한다.
View DataSource.java
package kr.sidnancy.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DataSource {
You can’t perform that action at this time.