Skip to content

Commit

Permalink
finish minix jar client
Browse files Browse the repository at this point in the history
  • Loading branch information
Percy0601 committed May 28, 2015
1 parent 431a348 commit c43ce8d
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 26 deletions.
144 changes: 123 additions & 21 deletions boot-dubbo-simple-client/pom.xml
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>
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();
}
}
}
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 {

}
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 {
//
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
* @author percy
*
*/
package boot.dubbo.simple.client.config;
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());
}
}
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);
// }
//
//}
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 boot-dubbo-simple-client/src/main/resources/dubbo.properties
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
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();
}
}
26 changes: 23 additions & 3 deletions boot-dubbo-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
<artifactId>boot-dubbo-simple</artifactId>
<name>boot-dubbo-simple</name>
<url>http://maven.apache.org</url>

<packaging>war</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<start-class>boot.dubbo.simple.ApplicationBootstrap</start-class>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -92,6 +93,25 @@
<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>
Expand All @@ -102,5 +122,5 @@
<scope>test</scope>
</dependency>
</dependencies>
<packaging>war</packaging>

</project>
4 changes: 2 additions & 2 deletions boot-dubbo-simple/src/main/resources/dubbo.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
dubbo.container=log4j,spring
dubbo.application.name=demo-provider
dubbo.application.owner=percy
dubbo.registry.address=multicast://224.5.6.7:1234
#dubbo.registry.address=zookeeper://10.10.108.132:2181
#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
Expand Down

0 comments on commit c43ce8d

Please sign in to comment.