记得上下班打卡 | git大法好,push需谨慎

Commit 55a4afa3 authored by 张国柄's avatar 张国柄

+MongoTransactionManager

parent 5e76c5e8
...@@ -7,7 +7,10 @@ import org.springframework.boot.CommandLineRunner; ...@@ -7,7 +7,10 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.MongoTransactionManager;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -44,4 +47,9 @@ public class ServiceAdamApplication implements CommandLineRunner { ...@@ -44,4 +47,9 @@ public class ServiceAdamApplication implements CommandLineRunner {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Bean
MongoTransactionManager transactionManager(MongoDbFactory factory){
return new MongoTransactionManager(factory);
}
} }
...@@ -8,7 +8,10 @@ import org.springframework.boot.SpringApplication; ...@@ -8,7 +8,10 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.MongoTransactionManager;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -44,4 +47,9 @@ public class ServiceKylinApplication implements CommandLineRunner { ...@@ -44,4 +47,9 @@ public class ServiceKylinApplication implements CommandLineRunner {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Bean
MongoTransactionManager transactionManager(MongoDbFactory factory){
return new MongoTransactionManager(factory);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment