봄 부팅 처리 오라클 DB 장애 조치

Sunleo :

나는 차 dB 요청 및 보조 DB는 응용 프로그램에 대한 지원을 제공하기 시작합니다 서버에 실패 어디든지 현재의 DB 정보를 기록합니다 주석 요격을 작성하고 싶습니다.

내가 언급 한 링크에서 코드 아래에서 발견하지만 난이 특정의 ORCL 주석이를 찾기 위해 아래, 제발 도움에 AOP에 대한 @Aspect 같은 주석에 사용되는 찾을 수 없습니다.

<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"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:orcl="http://www.springframework.org/schema/data/orcl"
       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
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/data/orcl
       http://www.springframework.org/schema/data/orcl/spring-data-orcl-1.0.xsd">

    <aop:config>
        <aop:advisor pointcut="execution(* *..PetStoreFacade.insertOrder(..))" 1 
            advice-ref="racFailoverInterceptor" order="1"/>
        <aop:advisor pointcut="execution(* *..PetStoreFacade.*(..))" 2 
            advice-ref="txAdvice"/>
    </aop:config>

    <orcl:rac-failover-interceptor id="racFailoverInterceptor"/> 3

    <tx:advice id="txAdvice">
        <tx:attributes>
            <tx:method name="insert*"/>
            <tx:method name="update*"/>
            <tx:method name="*" read-only="true"/>
        </tx:attributes>
    </tx:advice>

</beans>

https://docs.spring.io/spring-data/jdbc/old-docs/2.0.0.BUILD-SNAPSHOT/reference/html/orcl.failover.html

BBL :

기본적으로, RAC 장애 조치 인터셉터를 작동하게하는 데 사용할 수있는 상자 "오라클"주석의 어떤 밖으로는 없다. 그러나 당신을 위해 일을 할 것입니다 새 사용자 정의 주석을 쉽게 추가 할 수 있습니다.

장식 데이터 오라클이 클래스 경로에 있음을 제공

메이븐의 pom.xml

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-oracle</artifactId>
    <version>1.2.1.RELEASE</version>
</dependency>

그냥 당신이 사용하려는 마커 주석을 만들 수 있습니다.

package org.example;
public @interface OracleFailover {
// just a marker annotation, no body
}

그것을 위해 고문을 구성

<aop:config>
    <aop:advisor 
       pointcut="@annotation(org.example.OracleFailover)" 
        advice-ref="racFailoverInterceptor" order="1"/>
</aop:config>

<orcl:rac-failover-interceptor id="racFailoverInterceptor"/>

그리고 귀하의 비즈니스 방법에 사용

package org.example;

@Service
public class SomeBusinessService {
    @OracleFailover
    void doSomethingWithOracle(){
        // body goes here
    }
}

그리고는 RAC 장애 조치 인터셉터는 트랜잭션이 이미 활성화되어있을 때 이루어집니다 경우 장애 조치 차단에서 예상대로하지 않습니다 작업 페일 오버 당신의 다국적 인터셉터 전에 가야 기억 해요.

추천

출처http://43.154.161.224:23101/article/api/json?id=213964&siteId=1