Instantly share code, notes, and snippets.

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 {
}
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;
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″/>
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;
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 –>
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 {