Anyframe 의 JDBC 실행관련 설정

Anyframe 의 JDBC 실행관련 설정


<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">


<bean id="injectionPatternPostProcessor"

class="org.anyframe.jdbc.support.impl.DefaultInjectionPatternPostProcessor">

<!-- check sql comment pattern -->

<!-- check 1 = 1 pattern - ex. '1' = '1' , 1= 1, '1'='1' -->

<!--

<property name="warningPatterns">

<list>

<value>-{2,}</value>

<value>'?1'?\s*=\s*'?1'?</value>

</list>

</property>

-->

</bean>

 

  <bean id="completeQueryPostProcessor"

    class="org.anyframe.jdbc.support.ext.ThreadLocalCompleteQueryPostProcessor" />


 <bean id="jdbcAspect" class="org.anyframe.jdbc.support.aspect.JdbcAspect">

  <property name="injectionPatternPostProcessor" ref="injectionPatternPostProcessor" />

  <property name="completeQueryPostProcessor" ref="completeQueryPostProcessor" />

 </bean>


  <aop:config>

<aop:pointcut id="jdbcPointcut" expression="execution(* *..*DataSource.*(..))" />

<aop:advisor advice-ref="jdbcAspect" pointcut-ref="jdbcPointcut" />

  </aop:config>

</beans>



Anyframe 샘플....

http://dev.anyframejava.org/docs/anyframe/plugin/optional/jdbc-support/1.0.2/reference/html/ch04.html

public class ThreadLocalCompleteQueryPostProcessor extends DefaultCompleteQueryPostProcessor {

    @Override
    public void processCompleteQuery(String sql) {
        super.processCompleteQuery(sql);

        if ("Q".equals(SharedInfoHolder.getJobType())) {
            SharedInfoHolder.setExecutedQuery(sql);
            // throw new QueryLogException(sql);
        }
    }

}


'Programming > Framework' 카테고리의 다른 글

Akka  (0) 2014.02.18
antlr  (0) 2013.04.26
Transaction 설정 샘플  (0) 2012.10.17
Anyframe 의 JDBC 실행관련 설정  (0) 2012.10.17