From abe43063eebb23edad7c2c9abf8a37c68fa04a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A5=8A=E6=85=B6=E5=A0=82?= Date: Mon, 10 Sep 2018 15:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8=20AspectJ=20=E8=99=95?= =?UTF-8?q?=E7=90=86=20Transaction=EF=BC=8C=E8=AE=93=E5=85=A7=E9=83=A8?= =?UTF-8?q?=E4=BA=92=20call=20=E7=9A=84=20transation=20=E8=83=BD=E5=A4=A0?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 72 ++++++++++++++++++- .../ym/springtest/SpringTestApplication.java | 3 + 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5a937d1..3bd577a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 @@ -15,7 +16,7 @@ org.springframework.boot spring-boot-starter-parent 1.5.15.RELEASE - + @@ -53,6 +54,16 @@ com.microsoft.sqlserver mssql-jdbc + + + org.aspectj + aspectjrt + + + + org.springframework + spring-aspects + @@ -61,7 +72,64 @@ org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + aspectj-maven-plugin + 1.6 + + + + compile + + + + + + 1.7 + true + + ${project.build.outputDirectory} + + + + org.springframework + spring-aspects + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + aspectj-maven-plugin + [1.0,) + + test-compile + compile + + + + + + + + + + + + diff --git a/src/main/java/org/ylhealth/ym/springtest/SpringTestApplication.java b/src/main/java/org/ylhealth/ym/springtest/SpringTestApplication.java index 19be45a..8eac0e5 100644 --- a/src/main/java/org/ylhealth/ym/springtest/SpringTestApplication.java +++ b/src/main/java/org/ylhealth/ym/springtest/SpringTestApplication.java @@ -2,8 +2,11 @@ package org.ylhealth.ym.springtest; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.AdviceMode; +import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication +@EnableTransactionManagement(mode=AdviceMode.ASPECTJ) public class SpringTestApplication { public static void main(String[] args) { -- 2.26.2