forked from Percy0601/boot-dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
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
13 changed files
with
317 additions
and
26 deletions.
There are no files selected for viewing
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,125 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>cn.creditease</groupId> | ||
<artifactId>boot-dubbo</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>boot-dubbo-simple-client</artifactId> | ||
<name>boot-dubbo-simple-client</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>cn.creditease</groupId> | ||
<artifactId>boot-dubbo</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>boot-dubbo-simple-client</artifactId> | ||
<name>boot-dubbo-simple-client</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<start-class>boot.dubbo.simple.ApplicationBootstrap</start-class> | ||
<zookeeper.version>3.4.6</zookeeper.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>cn.creditease</groupId> | ||
<artifactId>boot-dubbo-api</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>resteasy-jaxrs</artifactId> | ||
<groupId>org.jboss.resteasy</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>resteasy-jackson-provider</artifactId> | ||
<groupId>org.jboss.resteasy</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>resteasy-jaxb-provider</artifactId> | ||
<groupId>org.jboss.resteasy</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>validation-api</artifactId> | ||
<groupId>javax.validation</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>2.8.4</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>guava</artifactId> | ||
<groupId>com.google.guava</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>curator-framework</artifactId> | ||
<groupId>org.apache.curator</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>curator-client</artifactId> | ||
<groupId>org.apache.curator</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>aopalliance</artifactId> | ||
<groupId>aopalliance</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<groupId>javax.servlet</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>httpclient</artifactId> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>commons-pool</artifactId> | ||
<groupId>commons-pool</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>commons-codec</artifactId> | ||
<groupId>commons-codec</groupId> | ||
</exclusion> | ||
<exclusion> | ||
<artifactId>httpcore</artifactId> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-validator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.spec.javax.el</groupId> | ||
<artifactId>jboss-el-api_3.0_spec</artifactId> | ||
<version>1.0.0.Final</version> | ||
</dependency> | ||
<!-- zookeeper start --> | ||
<dependency> | ||
<groupId>org.apache.zookeeper</groupId> | ||
<artifactId>zookeeper</artifactId> | ||
<version>3.4.6</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<groupId>org.slf4j</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.sgroschupf</groupId> | ||
<artifactId>zkclient</artifactId> | ||
<version>0.1</version> | ||
</dependency> | ||
<!-- zookeeper end --> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
19 changes: 19 additions & 0 deletions
19
boot-dubbo-simple-client/src/main/java/boot/dubbo/simple/client/ApplicationBootstrap.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 boot.dubbo.simple.client; | ||
|
||
import java.io.IOException; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ApplicationBootstrap { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ApplicationBootstrap.class, args); | ||
try { | ||
System.in.read(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
boot-dubbo-simple-client/src/main/java/boot/dubbo/simple/client/config/DubboConfig.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,10 @@ | ||
package boot.dubbo.simple.client.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.ImportResource; | ||
|
||
@Configuration | ||
@ImportResource("classpath:META-INF/spring/applicationContext.xml") | ||
public class DubboConfig { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
boot-dubbo-simple-client/src/main/java/boot/dubbo/simple/client/config/WebConfig.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,11 @@ | ||
package boot.dubbo.simple.client.config; | ||
|
||
//import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
//import org.springframework.context.annotation.ComponentScan; | ||
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||
// | ||
//@SpringBootApplication | ||
//@ComponentScan(basePackages = "boot") | ||
//public class WebConfig extends WebMvcConfigurerAdapter { | ||
// | ||
//} |
8 changes: 8 additions & 0 deletions
8
boot-dubbo-simple-client/src/main/java/boot/dubbo/simple/client/config/package-info.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,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* @author percy | ||
* | ||
*/ | ||
package boot.dubbo.simple.client.config; |
21 changes: 21 additions & 0 deletions
21
...-dubbo-simple-client/src/main/java/boot/dubbo/simple/client/service/UserServiceUsing.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,21 @@ | ||
package boot.dubbo.simple.client.service; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import boot.dubbo.api.User; | ||
import boot.dubbo.api.UserService; | ||
|
||
import com.alibaba.dubbo.config.annotation.Reference; | ||
|
||
@Service | ||
public class UserServiceUsing { | ||
@Reference | ||
private UserService userService; | ||
|
||
public void test() { | ||
List<User> users = userService.findAll(); | ||
System.out.println("===========" + users.size()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...dubbo-simple-client/src/main/java/boot/dubbo/simple/client/starter/SpringBootStarter.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,42 @@ | ||
package boot.dubbo.simple.client.starter; | ||
|
||
//import javax.servlet.ServletContext; | ||
//import javax.servlet.ServletException; | ||
// | ||
//import org.slf4j.Logger; | ||
//import org.slf4j.LoggerFactory; | ||
//import org.springframework.beans.factory.annotation.Autowired; | ||
//import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
//import org.springframework.boot.builder.SpringApplicationBuilder; | ||
//import org.springframework.boot.context.web.SpringBootServletInitializer; | ||
//import org.springframework.context.annotation.ComponentScan; | ||
//import org.springframework.core.env.Environment; | ||
|
||
//@SpringBootApplication | ||
//@ComponentScan(basePackages = "boot") | ||
//public class SpringBootStarter extends SpringBootServletInitializer { | ||
// private Logger log = LoggerFactory.getLogger(SpringBootStarter.class); | ||
// | ||
// @Autowired | ||
// private Environment env; | ||
// | ||
// @Override | ||
// protected SpringApplicationBuilder configure( | ||
// SpringApplicationBuilder application) { | ||
// log.info("=============容器启动(Spring Boot Container Start...)============="); | ||
// return application.sources(WebConfig.class); | ||
// } | ||
// | ||
// /** | ||
// * Config ServletListener, ServletFilter | ||
// */ | ||
// @Override | ||
// public void onStartup(ServletContext servletContext) | ||
// throws ServletException { | ||
// log.info("+++++++++++++容器启动(Web Container Servetlet Start...)+++++++++++++"); | ||
// log.info("++++++++++++++++++++++++++{}" + (env == null)); | ||
// | ||
// super.onStartup(servletContext); | ||
// } | ||
// | ||
//} |
11 changes: 11 additions & 0 deletions
11
boot-dubbo-simple-client/src/main/resources/META-INF/spring/applicationContext.xml
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> | ||
<dubbo:application name="boot-simple-client" owner="percy" organization="dubbox" /> | ||
<dubbo:registry address="zookeeper://10.10.108.132:2181" /> | ||
<!-- 扫描注解包路径,多个包用逗号分隔,不填pacakge表示扫描当前ApplicationContext中所有的类 --> | ||
<dubbo:annotation package="boot.dubbo" /> | ||
<!-- <dubbo:reference id="userService" interface="boot.dubbo.api.UserService" protocol="rest"/>--> | ||
</beans> |
Empty file.
25 changes: 25 additions & 0 deletions
25
boot-dubbo-simple-client/src/main/resources/dubbo.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## | ||
# Copyright 1999-2011 Alibaba Group. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
## | ||
dubbo.container=log4j,spring | ||
dubbo.application.name=demo-web | ||
dubbo.application.owner=william | ||
#dubbo.registry.address=multicast://224.5.6.7:1234 | ||
dubbo.registry.address=zookeeper://10.10.108.132:2181 | ||
#dubbo.registry.address=redis://127.0.0.1:6379 | ||
#dubbo.registry.address=dubbo://127.0.0.1:9090 | ||
#dubbo.monitor.protocol=registry | ||
#dubbo.log4j.file=logs/dubbo-demo-consumer.log | ||
#dubbo.log4j.level=WARN |
22 changes: 22 additions & 0 deletions
22
boot-dubbo-simple-client/src/test/java/boot/dubbo/simple/client/TrainingTest.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,22 @@ | ||
package boot.dubbo.simple.client; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.SpringApplicationConfiguration; | ||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||
|
||
import boot.dubbo.simple.client.service.UserServiceUsing; | ||
|
||
@RunWith(SpringJUnit4ClassRunner.class) | ||
@SpringApplicationConfiguration(classes = ApplicationBootstrap.class) | ||
public class TrainingTest { | ||
|
||
@Autowired | ||
UserServiceUsing userServiceUsing; | ||
|
||
@Test | ||
public void test() { | ||
userServiceUsing.test(); | ||
} | ||
} |
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