Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
110 additions
and
64 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
jdbc-demo/springcloud-jdbc-demo3/src/main/java/com/example/demo/config/MyConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.demo.config; | ||
|
||
import com.lorne.tx.springcloud.feign.TransactionRestTemplateInterceptor; | ||
import feign.RequestInterceptor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* Created by lorne on 2017/6/28. | ||
*/ | ||
|
||
@Configuration | ||
public class MyConfiguration { | ||
|
||
@Bean | ||
public RequestInterceptor requestInterceptor(){ | ||
return new TransactionRestTemplateInterceptor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...tis-demo/springcloud-mybatis-demo1/src/main/java/com/example/demo/client/Demo2Client.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
package com.example.demo.client; | ||
|
||
//import com.example.demo.config.MyConfiguration; | ||
import com.example.demo.entity.Test; | ||
import com.lorne.tx.springcloud.feign.TransactionRestTemplateConfiguration; | ||
import org.springframework.cloud.netflix.feign.FeignClient; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by lorne on 2017/6/27. | ||
*/ | ||
@FeignClient(value = "demo2",configuration = TransactionRestTemplateConfiguration.class) | ||
@FeignClient(value = "demo2",fallback = Demo2ClientHystric.class) | ||
public interface Demo2Client { | ||
|
||
|
||
@RequestMapping("/demo/list") | ||
@RequestMapping(value = "/demo/list",method = RequestMethod.GET) | ||
List<Test> list(); | ||
|
||
|
||
@RequestMapping("/demo/save") | ||
@RequestMapping(value = "/demo/save",method = RequestMethod.GET) | ||
int save(); | ||
} |
26 changes: 26 additions & 0 deletions
26
...o/springcloud-mybatis-demo1/src/main/java/com/example/demo/client/Demo2ClientHystric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.demo.client; | ||
|
||
import com.example.demo.entity.Test; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by fangzhipeng on 2017/4/6. | ||
*/ | ||
@Component | ||
public class Demo2ClientHystric implements Demo2Client { | ||
|
||
|
||
@Override | ||
public List<Test> list() { | ||
System.out.println("进入断路器-list。。。"); | ||
return null; | ||
} | ||
|
||
@Override | ||
public int save() { | ||
System.out.println("进入断路器-save。。。"); | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
mybatis-demo/springcloud-mybatis-demo1/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters