├── .gitignore ├── LICENSE ├── README.md ├── fallsea-motan-client ├── .classpath ├── .project ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── fallsea │ └── motan │ ├── MotanClientConfig.java │ └── MotanConfig.java ├── fallsea-motan-demo ├── fallsea-motan-api-demo │ ├── .classpath │ ├── .project │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── fallsea │ │ └── demo │ │ ├── pojo │ │ └── Demo.java │ │ └── service │ │ ├── MotanDemoService.java │ │ └── MotanDemoServiceAsync.java ├── fallsea-motan-client-demo │ ├── .classpath │ ├── .project │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ ├── com │ │ │ └── fallsea │ │ │ │ └── demo │ │ │ │ └── web │ │ │ │ ├── DemoController.java │ │ │ │ └── HelloController.java │ │ └── run │ │ │ └── MotanClientWeb.java │ │ └── resources │ │ ├── application.yml │ │ └── log4j.properties └── fallsea-motan-server-demo │ ├── .classpath │ ├── .project │ ├── pom.xml │ └── src │ └── main │ ├── java │ ├── com │ │ └── fallsea │ │ │ └── demo │ │ │ └── service │ │ │ └── impl │ │ │ └── MotanDemoServiceImpl.java │ └── run │ │ └── MotanServer.java │ └── resources │ ├── application.yml │ └── log4j.properties └── fallsea-motan-server ├── .classpath ├── .project ├── pom.xml └── src └── main └── java └── com └── fallsea └── motan ├── MotanConfig.java └── MotanServerConfig.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # spring boot motan 2 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/fallsea/spring-boot-starter-motan/blob/master/LICENSE) 3 | 4 | [GitHub下载](https://github.com/fallsea/spring-boot-starter-motan) 5 | [码云下载](https://gitee.com/fallsea/spring-boot-starter-motan) 6 | 7 | ## 项目介绍 8 | > 基于spring boot motan 整合demo(**支持异步和同步调用**),motan配置信息存放在application.yml中,详细配置请参考官网[配置清单](https://github.com/weibocom/motan/wiki/zh_configuration) 9 | > 此demo基于zookeeper 注册中心,如果要直接启动,需要安装zookeeper,也可以更改为其他注册中心测试 10 | 11 | ## 项目结构 12 | ``` lua 13 | spring-boot-starter-motan 14 | ├── fallsea-motan-client -- 客户端通用配置 15 | ├── fallsea-motan-server -- 服务端通用配置 16 | ├── fallsea-motan-demo -- demo 示例 17 | |   ├── fallsea-motan-api-demo -- api 示例 18 | |   ├── fallsea-motan-client-demo -- 客户端调用示例 19 | |   ├── fallsea-motan-server-demo -- 服务端示例 20 | ``` 21 | 22 | ## 服务端 23 | 24 | > 启动类 MotanServer 25 | > 配置说明,详细配置请参考官网[配置清单](https://github.com/weibocom/motan/wiki/zh_configuration) 26 | 27 | ```yml 28 | fallsea : 29 | motan : 30 | #注册中心配置 31 | registry : 32 | regProtocol : zookeeper #注册中心协议 33 | address : 127.0.0.1:2181 #注册中心地址 34 | requestTimeout : 1000 #注册中心连接超时时间(毫秒) 35 | connectTimeout : 3000 #注册中心请求超时时间(毫秒) 36 | #协议配置 37 | protocol : 38 | name : motan #协议名称 39 | minWorkerThread : 20 #最小工作pool线程数 40 | maxWorkerThread : 50 #最大工作pool线程数 41 | filter : statistic 42 | #指定需要解析的包名 43 | annotation : 44 | package : com.fallsea.demo 45 | #服务端配置 46 | server : 47 | export : 'fallseaMotan:9999' #服务端口 48 | group : fallsea 49 | registry : fallseaRegistryConfig 50 | ``` 51 | 52 | ## 客户端 53 | 54 | > 启动类 MotanClientWeb 55 | 客户端测试地址:http://localhost:8080/hello/fallsea 56 | > 配置说明,详细配置请参考[配置清单](https://github.com/weibocom/motan/wiki/zh_configuration) 57 | 58 | ```yml 59 | fallsea : 60 | motan : 61 | #注册中心配置 62 | registry : 63 | regProtocol : zookeeper #注册中心协议 64 | address : 127.0.0.1:2181 #注册中心地址 65 | requestTimeout : 1000 #注册中心连接超时时间(毫秒) 66 | connectTimeout : 3000 #注册中心请求超时时间(毫秒) 67 | #协议配置 68 | protocol : 69 | name : motan #协议名称 70 | minWorkerThread : 20 #最小工作pool线程数 71 | maxWorkerThread : 50 #最大工作pool线程数 72 | filter : statistic 73 | #指定需要解析的包名 74 | annotation : 75 | package : com.fallsea.demo 76 | #客户端配置 77 | client : 78 | protocol : fallseaMotan 79 | group : fallsea 80 | check : false 81 | requestTimeout : 3000 #请求超时时间(毫秒) 82 | connectTimeout : 5000 #连接超时时间(毫秒) 83 | registry : fallseaRegistryConfig 84 | ``` 85 | -------------------------------------------------------------------------------- /fallsea-motan-client/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-client/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fallsea-motan-client 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fallsea 4 | fallsea-motan-client 5 | 1.0.1-SNAPSHOT 6 | jar 7 | 8 | 9 | org.springframework.boot 10 | spring-boot-starter-parent 11 | 1.5.8.RELEASE 12 | 13 | 14 | 15 | UTF-8 16 | 1.7 17 | 1.0.0 18 | 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-configuration-processor 28 | true 29 | 30 | 31 | com.weibo 32 | motan-core 33 | ${motan.version} 34 | 35 | 36 | com.weibo 37 | motan-transport-netty 38 | ${motan.version} 39 | 40 | 41 | 42 | com.weibo 43 | motan-springsupport 44 | ${motan.version} 45 | 46 | 47 | 48 | com.weibo 49 | motan-registry-zookeeper 50 | ${motan.version} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.apache.maven.plugins 62 | maven-site-plugin 63 | 64 | UTF-8 65 | 66 | 67 | 68 | org.apache.maven.plugins 69 | maven-compiler-plugin 70 | 71 | lib 72 | 1.7 73 | 1.7 74 | UTF-8 75 | 76 | 77 | 78 | 79 | org.apache.maven.plugins 80 | maven-resources-plugin 81 | 82 | UTF-8 83 | 84 | 85 | 86 | 87 | org.apache.maven.plugins 88 | maven-surefire-plugin 89 | 90 | once 91 | -Dfile.encoding=UTF-8 92 | UTF-8 93 | 94 | 95 | 96 | 97 | org.apache.maven.plugins 98 | maven-source-plugin 99 | 100 | 101 | attach-sources 102 | package 103 | 104 | jar-no-fork 105 | 106 | 107 | 108 | 109 | 110 | org.apache.maven.plugins 111 | maven-javadoc-plugin 112 | 113 | UTF-8 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /fallsea-motan-client/src/main/java/com/fallsea/motan/MotanClientConfig.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.motan; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.weibo.api.motan.config.springsupport.BasicRefererConfigBean; 8 | 9 | /** 10 | * @Description: motan client配置 11 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 12 | * @author: fallsea 13 | * @version 1.0 14 | * @date: 2017年11月18日 下午3:20:25 15 | */ 16 | @Configuration 17 | public class MotanClientConfig 18 | { 19 | /** 20 | * @Description: 客户端配置 21 | * @author: fallsea 22 | * @date: 2017年11月18日 下午3:20:38 23 | * @return 24 | */ 25 | @Bean(name = "fallseaClientBasicConfig") 26 | @ConfigurationProperties(prefix = "fallsea.motan.client") 27 | public BasicRefererConfigBean baseRefererConfig() { 28 | BasicRefererConfigBean config = new BasicRefererConfigBean(); 29 | return config; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /fallsea-motan-client/src/main/java/com/fallsea/motan/MotanConfig.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.motan; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.weibo.api.motan.config.springsupport.AnnotationBean; 8 | import com.weibo.api.motan.config.springsupport.ProtocolConfigBean; 9 | import com.weibo.api.motan.config.springsupport.RegistryConfigBean; 10 | 11 | /** 12 | * @Description: motan通用配置 13 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 14 | * @author: fallsea 15 | * @version 1.0 16 | * @date: 2017年11月18日 下午3:20:48 17 | */ 18 | @Configuration 19 | public class MotanConfig 20 | { 21 | /** 22 | * @Description: 声明Annotation用来指定需要解析的包名 23 | * @author: fallsea 24 | * @date: 2017年11月18日 下午3:20:54 25 | * @return 26 | */ 27 | @Bean 28 | @ConfigurationProperties(prefix = "fallsea.motan.annotation") 29 | public AnnotationBean motanAnnotationBean() { 30 | AnnotationBean motanAnnotationBean = new AnnotationBean(); 31 | return motanAnnotationBean; 32 | } 33 | 34 | /** 35 | * @Description: 协议配置 36 | * @author: fallsea 37 | * @date: 2017年11月18日 下午3:20:59 38 | * @return 39 | */ 40 | @Bean(name = "fallseaMotan") 41 | @ConfigurationProperties(prefix = "fallsea.motan.protocol") 42 | public ProtocolConfigBean protocolConfig() { 43 | ProtocolConfigBean config = new ProtocolConfigBean(); 44 | return config; 45 | } 46 | 47 | /** 48 | * @Description: 注册中心配置 49 | * @author: fallsea 50 | * @date: 2017年11月18日 下午3:21:04 51 | * @return 52 | */ 53 | @Bean(name = "fallseaRegistryConfig") 54 | @ConfigurationProperties(prefix = "fallsea.motan.registry") 55 | public RegistryConfigBean registryConfig() { 56 | RegistryConfigBean config = new RegistryConfigBean(); 57 | return config; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fallsea-motan-api-demo 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fallsea 4 | fallsea-motan-api-demo 5 | 1.0.1-SNAPSHOT 6 | jar 7 | 8 | 9 | org.springframework.boot 10 | spring-boot-starter-parent 11 | 1.5.8.RELEASE 12 | 13 | 14 | 15 | UTF-8 16 | 1.7 17 | 1.0.0 18 | 19 | 20 | 21 | 22 | com.weibo 23 | motan-core 24 | ${motan.version} 25 | 26 | 27 | com.weibo 28 | motan-transport-netty 29 | ${motan.version} 30 | 31 | 32 | 33 | com.weibo 34 | motan-springsupport 35 | ${motan.version} 36 | 37 | 38 | 39 | com.weibo 40 | motan-registry-zookeeper 41 | ${motan.version} 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-site-plugin 52 | 53 | UTF-8 54 | 55 | 56 | 57 | org.apache.maven.plugins 58 | maven-compiler-plugin 59 | 60 | lib 61 | 1.7 62 | 1.7 63 | UTF-8 64 | 65 | 66 | 67 | 68 | org.apache.maven.plugins 69 | maven-resources-plugin 70 | 71 | UTF-8 72 | 73 | 74 | 75 | 76 | org.apache.maven.plugins 77 | maven-surefire-plugin 78 | 79 | once 80 | -Dfile.encoding=UTF-8 81 | UTF-8 82 | 83 | 84 | 85 | 86 | org.apache.maven.plugins 87 | maven-source-plugin 88 | 89 | 90 | attach-sources 91 | package 92 | 93 | jar-no-fork 94 | 95 | 96 | 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-javadoc-plugin 101 | 102 | UTF-8 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/src/main/java/com/fallsea/demo/pojo/Demo.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.pojo; 2 | 3 | import java.io.Serializable; 4 | import java.math.BigDecimal; 5 | 6 | /** 7 | * @Description: 测试类 8 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 9 | * @author: fallsea 10 | * @version 1.0 11 | * @date: 2017年11月18日 下午3:19:30 12 | */ 13 | public class Demo implements Serializable 14 | { 15 | private static final long serialVersionUID = -8754007944801649212L; 16 | 17 | private BigDecimal id; 18 | 19 | private String name; 20 | 21 | public BigDecimal getId() 22 | { 23 | return id; 24 | } 25 | 26 | public void setId(BigDecimal id) 27 | { 28 | this.id = id; 29 | } 30 | 31 | public String getName() 32 | { 33 | return name; 34 | } 35 | 36 | public void setName(String name) 37 | { 38 | this.name = name; 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/src/main/java/com/fallsea/demo/service/MotanDemoService.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.service; 2 | 3 | import com.fallsea.demo.pojo.Demo; 4 | import com.weibo.api.motan.transport.async.MotanAsync; 5 | 6 | /** 7 | * @Description: 测试接口 8 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 9 | * @author: fallsea 10 | * @version 1.0 11 | * @date: 2017年11月18日 下午3:19:22 12 | */ 13 | @MotanAsync 14 | public interface MotanDemoService 15 | { 16 | 17 | String hello(String name); 18 | 19 | 20 | Demo test(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-api-demo/src/main/java/com/fallsea/demo/service/MotanDemoServiceAsync.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.service; 2 | 3 | import com.weibo.api.motan.rpc.ResponseFuture; 4 | import java.lang.String; 5 | 6 | public interface MotanDemoServiceAsync extends MotanDemoService { 7 | ResponseFuture helloAsync(String name); 8 | 9 | ResponseFuture testAsync(); 10 | } 11 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fallsea-motan-client-demo 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fallsea 4 | fallsea-motan-client-demo 5 | 1.0.0-SNAPSHOT 6 | jar 7 | 8 | 9 | org.springframework.boot 10 | spring-boot-starter-parent 11 | 1.5.7.RELEASE 12 | 13 | 14 | 15 | UTF-8 16 | 1.7 17 | 18 | 19 | 20 | 21 | fallsea 22 | fallsea-motan-client 23 | 1.0.0-SNAPSHOT 24 | 25 | 26 | fallsea 27 | fallsea-motan-api-demo 28 | 1.0.0-SNAPSHOT 29 | 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-starter-web 39 | 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-log4j 44 | 1.3.8.RELEASE 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-starter-test 49 | test 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.apache.maven.plugins 60 | maven-site-plugin 61 | 62 | UTF-8 63 | 64 | 65 | 66 | org.apache.maven.plugins 67 | maven-compiler-plugin 68 | 69 | lib 70 | 1.7 71 | 1.7 72 | UTF-8 73 | 74 | 75 | 76 | 77 | org.apache.maven.plugins 78 | maven-resources-plugin 79 | 80 | UTF-8 81 | 82 | 83 | 84 | 85 | org.apache.maven.plugins 86 | maven-surefire-plugin 87 | 88 | once 89 | -Dfile.encoding=UTF-8 90 | UTF-8 91 | 92 | 93 | 94 | 95 | org.apache.maven.plugins 96 | maven-source-plugin 97 | 98 | 99 | attach-sources 100 | package 101 | 102 | jar-no-fork 103 | 104 | 105 | 106 | 107 | 108 | org.apache.maven.plugins 109 | maven-javadoc-plugin 110 | 111 | UTF-8 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/src/main/java/com/fallsea/demo/web/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | import com.fallsea.demo.pojo.Demo; 7 | import com.fallsea.demo.service.MotanDemoServiceAsync; 8 | import com.weibo.api.motan.config.springsupport.annotation.MotanReferer; 9 | 10 | /** 11 | * @Description: 12 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 13 | * @author: fallsea 14 | * @version 1.0 15 | * @date: 2017年11月18日 下午3:25:25 16 | */ 17 | @RestController 18 | public class DemoController 19 | { 20 | 21 | @MotanReferer(basicReferer = "fallseaClientBasicConfig") 22 | private MotanDemoServiceAsync motanDemoService; 23 | 24 | @RequestMapping(value = "/demo") 25 | public Demo hello() 26 | { 27 | return motanDemoService.test(); 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/src/main/java/com/fallsea/demo/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | import com.fallsea.demo.service.MotanDemoServiceAsync; 9 | import com.weibo.api.motan.config.springsupport.annotation.MotanReferer; 10 | import com.weibo.api.motan.rpc.ResponseFuture; 11 | 12 | /** 13 | * @Description: 异步测试 14 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 15 | * @author: fallsea 16 | * @version 1.0 17 | * @date: 2017年11月18日 下午3:25:21 18 | */ 19 | @Controller 20 | @RequestMapping("/hello") 21 | public class HelloController 22 | { 23 | 24 | @MotanReferer(basicReferer = "fallseaClientBasicConfig") 25 | private MotanDemoServiceAsync motanDemoService; 26 | 27 | @RequestMapping(value = "/{name}") 28 | @ResponseBody 29 | public String hello(@PathVariable String name) 30 | { 31 | ResponseFuture future = motanDemoService.helloAsync("测试"); 32 | ResponseFuture future2 = motanDemoService.helloAsync("测试2222222"); 33 | System.err.println(future.getValue()); 34 | System.err.println(future2.getValue()); 35 | 36 | return motanDemoService.hello(name); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/src/main/java/run/MotanClientWeb.java: -------------------------------------------------------------------------------- 1 | package run; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ComponentScan; 6 | 7 | 8 | /** 9 | * @Description: 启动类 10 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 11 | * @author: fallsea 12 | * @version 1.0 13 | * @date: 2017年11月18日 下午3:25:11 14 | */ 15 | @ComponentScan(basePackages={"com.fallsea"}) 16 | @SpringBootApplication 17 | public class MotanClientWeb 18 | { 19 | public static void main(String[] args) 20 | { 21 | SpringApplication.run(MotanClientWeb.class, args); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | fallsea : 2 | motan : 3 | #注册中心配置 4 | registry : 5 | regProtocol : zookeeper #注册中心协议 6 | address : 127.0.0.1:2181 #注册中心地址 7 | requestTimeout : 1000 #注册中心连接超时时间(毫秒) 8 | connectTimeout : 3000 #注册中心请求超时时间(毫秒) 9 | #协议配置 10 | protocol : 11 | name : motan #协议名称 12 | minWorkerThread : 20 #最小工作pool线程数 13 | maxWorkerThread : 50 #最大工作pool线程数 14 | filter : statistic 15 | #指定需要解析的包名 16 | annotation : 17 | package : com.fallsea.demo 18 | #客户端配置 19 | client : 20 | protocol : fallseaMotan 21 | group : fallsea 22 | check : false 23 | requestTimeout : 30000 #请求超时时间(毫秒) 24 | connectTimeout : 5000 #连接超时时间(毫秒) 25 | registry : fallseaRegistryConfig -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-client-demo/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout,extProfile 2 | ######################### logger ############################## 3 | 4 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 6 | log4j.appender.stdout.layout.conversionPattern = %d [%t] %-5p %c - %m%n 7 | #log4j.logger.extProfile=DEBUG, extProfile 8 | log4j.additivity.extProfile=false 9 | 10 | log4j.appender.extProfile=org.apache.log4j.RollingFileAppender 11 | log4j.appender.extProfile.File=logs/extProfile.log 12 | log4j.appender.extProfile.MaxFileSize=20480KB 13 | log4j.appender.extProfile.MaxBackupIndex=10 14 | log4j.appender.extProfile.layout=org.apache.log4j.PatternLayout 15 | log4j.appender.extProfile.layout.ConversionPattern=%d [%t] %-5p %c - %m%n -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fallsea-motan-server-demo 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | com.genuitec.eclipse.springframework.springbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | org.springframework.ide.eclipse.core.springbuilder 35 | 36 | 37 | 38 | 39 | org.springframework.ide.eclipse.boot.validation.springbootbuilder 40 | 41 | 42 | 43 | 44 | 45 | org.springframework.ide.eclipse.core.springnature 46 | com.genuitec.eclipse.springframework.springnature 47 | org.eclipse.jem.workbench.JavaEMFNature 48 | org.eclipse.wst.common.modulecore.ModuleCoreNature 49 | org.eclipse.jdt.core.javanature 50 | org.eclipse.m2e.core.maven2Nature 51 | org.eclipse.wst.common.project.facet.core.nature 52 | 53 | 54 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fallsea 4 | fallsea-motan-server-demo 5 | 1.0.0-SNAPSHOT 6 | jar 7 | 8 | 9 | org.springframework.boot 10 | spring-boot-starter-parent 11 | 1.5.8.RELEASE 12 | 13 | 14 | 15 | UTF-8 16 | 1.7 17 | 18 | 19 | 20 | 21 | fallsea 22 | fallsea-motan-server 23 | 1.0.0-SNAPSHOT 24 | 25 | 26 | fallsea 27 | fallsea-motan-api-demo 28 | 1.0.0-SNAPSHOT 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-log4j 38 | 1.3.8.RELEASE 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-test 43 | test 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.codehaus.mojo 52 | build-helper-maven-plugin 53 | 3.0.0 54 | 55 | 56 | generate-sources 57 | 58 | add-source 59 | 60 | 61 | 62 | ${project.build.directory}/generated-sources/annotations 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/src/main/java/com/fallsea/demo/service/impl/MotanDemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.demo.service.impl; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.fallsea.demo.pojo.Demo; 6 | import com.fallsea.demo.service.MotanDemoService; 7 | import com.weibo.api.motan.config.springsupport.annotation.MotanService; 8 | 9 | /** 10 | * @Description: 测试服务类 11 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 12 | * @author: fallsea 13 | * @version 1.0 14 | * @date: 2017年11月18日 下午3:24:29 15 | */ 16 | @MotanService 17 | public class MotanDemoServiceImpl implements MotanDemoService 18 | { 19 | 20 | @Override 21 | public String hello(String name) 22 | { 23 | System.err.println("开始进入---------------"+name); 24 | try 25 | { 26 | Thread.sleep(5000); 27 | } 28 | catch (Exception e) 29 | { 30 | // TODO: handle exception 31 | } 32 | return "Hello " + name + "!"; 33 | } 34 | 35 | @Override 36 | public Demo test() 37 | { 38 | Demo demo = new Demo(); 39 | demo.setId(new BigDecimal(10000)); 40 | demo.setName("fallsea"); 41 | return demo; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/src/main/java/run/MotanServer.java: -------------------------------------------------------------------------------- 1 | package run; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.ComponentScan; 7 | 8 | import com.weibo.api.motan.common.MotanConstants; 9 | import com.weibo.api.motan.util.MotanSwitcherUtil; 10 | 11 | 12 | /** 13 | * @Description: 启动类 14 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 15 | * @author: fallsea 16 | * @version 1.0 17 | * @date: 2017年11月18日 下午3:24:18 18 | */ 19 | @ComponentScan(basePackages={"com.fallsea"}) 20 | @SpringBootApplication 21 | public class MotanServer 22 | { 23 | public static void main(String[] args) 24 | { 25 | SpringApplication.run(MotanServer.class, args); 26 | MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true); 27 | System.out.println("server start..."); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | fallsea : 2 | motan : 3 | #注册中心配置 4 | registry : 5 | regProtocol : zookeeper #注册中心协议 6 | address : 127.0.0.1:2181 #注册中心地址 7 | requestTimeout : 1000 #注册中心连接超时时间(毫秒) 8 | connectTimeout : 3000 #注册中心请求超时时间(毫秒) 9 | #协议配置 10 | protocol : 11 | name : motan #协议名称 12 | minWorkerThread : 20 #最小工作pool线程数 13 | maxWorkerThread : 50 #最大工作pool线程数 14 | filter : statistic 15 | #指定需要解析的包名 16 | annotation : 17 | package : com.fallsea.demo 18 | #服务端配置 19 | server : 20 | export : 'fallseaMotan:9999' #服务端口 21 | group : fallsea 22 | registry : fallseaRegistryConfig -------------------------------------------------------------------------------- /fallsea-motan-demo/fallsea-motan-server-demo/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, stdout,extProfile 2 | ######################### logger ############################## 3 | 4 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 6 | log4j.appender.stdout.layout.conversionPattern = %d [%t] %-5p %c - %m%n 7 | #log4j.logger.extProfile=DEBUG, extProfile 8 | log4j.additivity.extProfile=false 9 | 10 | log4j.appender.extProfile=org.apache.log4j.RollingFileAppender 11 | log4j.appender.extProfile.File=logs/extProfile.log 12 | log4j.appender.extProfile.MaxFileSize=20480KB 13 | log4j.appender.extProfile.MaxBackupIndex=10 14 | log4j.appender.extProfile.layout=org.apache.log4j.PatternLayout 15 | log4j.appender.extProfile.layout.ConversionPattern=%d [%t] %-5p %c - %m%n -------------------------------------------------------------------------------- /fallsea-motan-server/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fallsea-motan-server 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | 36 | 37 | -------------------------------------------------------------------------------- /fallsea-motan-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fallsea 4 | fallsea-motan-server 5 | 1.0.1-SNAPSHOT 6 | jar 7 | 8 | 9 | org.springframework.boot 10 | spring-boot-starter-parent 11 | 1.5.8.RELEASE 12 | 13 | 14 | 15 | UTF-8 16 | 1.7 17 | 1.0.0 18 | 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-configuration-processor 28 | true 29 | 30 | 31 | com.weibo 32 | motan-core 33 | ${motan.version} 34 | 35 | 36 | com.weibo 37 | motan-transport-netty 38 | ${motan.version} 39 | 40 | 41 | 42 | com.weibo 43 | motan-springsupport 44 | ${motan.version} 45 | 46 | 47 | 48 | com.weibo 49 | motan-registry-zookeeper 50 | ${motan.version} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | org.apache.maven.plugins 59 | maven-site-plugin 60 | 61 | UTF-8 62 | 63 | 64 | 65 | org.apache.maven.plugins 66 | maven-compiler-plugin 67 | 68 | lib 69 | 1.7 70 | 1.7 71 | UTF-8 72 | 73 | 74 | 75 | org.apache.maven.plugins 76 | maven-resources-plugin 77 | 78 | UTF-8 79 | 80 | 81 | 82 | org.apache.maven.plugins 83 | maven-surefire-plugin 84 | 85 | once 86 | -Dfile.encoding=UTF-8 87 | UTF-8 88 | 89 | 90 | 91 | org.apache.maven.plugins 92 | maven-source-plugin 93 | 94 | 95 | attach-sources 96 | package 97 | 98 | jar-no-fork 99 | 100 | 101 | 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-javadoc-plugin 106 | 107 | UTF-8 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /fallsea-motan-server/src/main/java/com/fallsea/motan/MotanConfig.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.motan; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.weibo.api.motan.config.springsupport.AnnotationBean; 8 | import com.weibo.api.motan.config.springsupport.ProtocolConfigBean; 9 | import com.weibo.api.motan.config.springsupport.RegistryConfigBean; 10 | 11 | /** 12 | * @Description: motan通用配置 13 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 14 | * @author: fallsea 15 | * @version 1.0 16 | * @date: 2017年11月18日 下午3:20:48 17 | */ 18 | @Configuration 19 | public class MotanConfig 20 | { 21 | /** 22 | * @Description: 声明Annotation用来指定需要解析的包名 23 | * @author: fallsea 24 | * @date: 2017年11月18日 下午3:20:54 25 | * @return 26 | */ 27 | @Bean 28 | @ConfigurationProperties(prefix = "fallsea.motan.annotation") 29 | public AnnotationBean motanAnnotationBean() { 30 | AnnotationBean motanAnnotationBean = new AnnotationBean(); 31 | return motanAnnotationBean; 32 | } 33 | 34 | /** 35 | * @Description: 协议配置 36 | * @author: fallsea 37 | * @date: 2017年11月18日 下午3:20:59 38 | * @return 39 | */ 40 | @Bean(name = "fallseaMotan") 41 | @ConfigurationProperties(prefix = "fallsea.motan.protocol") 42 | public ProtocolConfigBean protocolConfig() { 43 | ProtocolConfigBean config = new ProtocolConfigBean(); 44 | return config; 45 | } 46 | 47 | /** 48 | * @Description: 注册中心配置 49 | * @author: fallsea 50 | * @date: 2017年11月18日 下午3:21:04 51 | * @return 52 | */ 53 | @Bean(name = "fallseaRegistryConfig") 54 | @ConfigurationProperties(prefix = "fallsea.motan.registry") 55 | public RegistryConfigBean registryConfig() { 56 | RegistryConfigBean config = new RegistryConfigBean(); 57 | return config; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /fallsea-motan-server/src/main/java/com/fallsea/motan/MotanServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.fallsea.motan; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean; 8 | 9 | /** 10 | * @Description: motan server配置 11 | * @Copyright: 2017 www.fallsea.com Inc. All rights reserved. 12 | * @author: fallsea 13 | * @version 1.0 14 | * @date: 2017年11月18日 下午3:21:28 15 | */ 16 | @Configuration 17 | public class MotanServerConfig 18 | { 19 | /** 20 | * @Description: 服务端配置 21 | * @author: fallsea 22 | * @date: 2017年11月18日 下午3:21:33 23 | * @return 24 | */ 25 | @Bean 26 | @ConfigurationProperties(prefix = "fallsea.motan.server") 27 | public BasicServiceConfigBean baseServiceConfig() { 28 | BasicServiceConfigBean config = new BasicServiceConfigBean(); 29 | return config; 30 | } 31 | } 32 | --------------------------------------------------------------------------------