Skip to content
Permalink
Browse files
增加consumer provider模块
  • Loading branch information
chickenlj committed Oct 11, 2017
1 parent a9535c4 commit 8645813f73e89a15d4906d88c3dc94ab86597d20
Showing 76 changed files with 727 additions and 96 deletions.
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-feature-test</artifactId>
<groupId>com.alibaba.dubbo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>consumer-test</artifactId>


</project>
@@ -2,15 +2,13 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;


@SpringBootApplication
public class DubboFeatureTestApplication {
public class ConsumerTestApp {

public static void main(String[] args) throws InterruptedException {
SpringApplication.run(DubboFeatureTestApplication.class, args);
SpringApplication.run(ConsumerTestApp.class, args);
Thread.sleep(100000000);
}
}
@@ -1,8 +1,6 @@
package com.alibaba.dubbo.test.conf;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.ImportResource;

/**
@@ -1,4 +1,4 @@
package com.alibaba.dubbo.test.service;
package com.alibaba.dubbo.test.service.chain;

/**
* Created by ken.lj on 2017/9/8.
@@ -1,4 +1,4 @@
package com.alibaba.dubbo.test.service;
package com.alibaba.dubbo.test.service.chain;

/**
* Created by ken.lj on 2017/9/8.
@@ -1,4 +1,4 @@
package com.alibaba.dubbo.test.service;
package com.alibaba.dubbo.test.service.chain;

/**
* Created by ken.lj on 2017/9/8.
@@ -1,4 +1,4 @@
package com.alibaba.dubbo.test.service;
package com.alibaba.dubbo.test.service.chain;

/**
* Created by ken.lj on 2017/9/8.
@@ -1,7 +1,7 @@
package com.alibaba.dubbo.test.service.chain.impl;

import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.MouseService;
import com.alibaba.dubbo.test.service.chain.CatService;
import com.alibaba.dubbo.test.service.chain.MouseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1,8 +1,8 @@
package com.alibaba.dubbo.test.service.chain.impl;

import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.DogService;
import com.alibaba.dubbo.test.service.MouseService;
import com.alibaba.dubbo.test.service.chain.CatService;
import com.alibaba.dubbo.test.service.chain.DogService;
import com.alibaba.dubbo.test.service.chain.MouseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1,9 +1,9 @@
package com.alibaba.dubbo.test.service.chain.impl;

import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.DogService;
import com.alibaba.dubbo.test.service.LionService;
import com.alibaba.dubbo.test.service.MouseService;
import com.alibaba.dubbo.test.service.chain.CatService;
import com.alibaba.dubbo.test.service.chain.DogService;
import com.alibaba.dubbo.test.service.chain.LionService;
import com.alibaba.dubbo.test.service.chain.MouseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1,6 +1,6 @@
package com.alibaba.dubbo.test.service.chain.impl;

import com.alibaba.dubbo.test.service.MouseService;
import com.alibaba.dubbo.test.service.chain.MouseService;

import org.springframework.stereotype.Service;

@@ -1,12 +1,14 @@
package com.alibaba.dubbo.test.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.test.service.AnnotateService;

import org.springframework.stereotype.Service;

/**
* Created by ken.lj on 2017/9/19.
*/
@org.springframework.stereotype.Service
@Service
public class AnnotateServiceImpl implements AnnotateService {
@Override
public String sayHello() {
@@ -2,8 +2,6 @@

import com.alibaba.dubbo.test.service.AsyncService;

import org.springframework.stereotype.Service;

/**
* Created by ken.lj on 2017/9/24.
*/
@@ -3,8 +3,6 @@
import com.alibaba.dubbo.test.dto.Bean;
import com.alibaba.dubbo.test.service.DemoService;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@@ -2,8 +2,6 @@

import com.alibaba.dubbo.test.service.WSService;

import org.springframework.stereotype.Service;

/**
* Created by ken.lj on 2017/9/24.
*/
@@ -6,8 +6,6 @@
import com.alibaba.dubbo.test.service.DemoService;
import com.alibaba.dubbo.test.service.WSService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@@ -18,7 +16,6 @@
@RequestMapping("/testcase")
public class TestcaseController {

@Autowired
private DemoService demoService;
private AsyncService asyncService;
private CacheService cacheService;
File renamed without changes.
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- 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.
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">


<bean id="mouseService" class="com.alibaba.dubbo.MouseServiceImpl" />

<dubbo:annotation />

<context:component-scan base-package="com.alibaba.dubbo.test.service"> </context:component-scan>

</beans>
File renamed without changes.
@@ -24,7 +24,7 @@
<dubbo:application name="dubbo-feature-test" />

<!-- 使用multicast广播注册中心暴露服务地址 -->
<dubbo:registry client="curator" address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
<dubbo:registry client="curator" address="zookeeper://127.0.0.1:2181"/>

<!-- 用dubbo协议在20880端口暴露服务 -->
<dubbo:protocol name="dubbo" port="-1"/>
File renamed without changes.
File renamed without changes.
@@ -20,7 +20,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<bean id="mouseService" class="com.alibaba.dubbo.test.service.chain.impl.MouseServiceImpl" />
<bean id="mouseService" class="com.alibaba.dubbo.MouseServiceImpl" />

<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.alibaba.dubbo.test.service.MouseService" ref="mouseService"/>
@@ -6,7 +6,11 @@
<groupId>com.alibaba.dubbo</groupId>
<artifactId>dubbo-feature-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<modules>
<module>provider-test</module>
<module>consumer-test</module>
</modules>
<packaging>pom</packaging>

<name>dubbo-feature-test</name>
<description>Test project for Dubbo</description>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-feature-test</artifactId>
<groupId>com.alibaba.dubbo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>provider-test</artifactId>


</project>
@@ -0,0 +1,14 @@
package com.alibaba.dubbo.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class ProviderTestApp {

public static void main(String[] args) throws InterruptedException {
SpringApplication.run(ProviderTestApp.class, args);
Thread.sleep(100000000);
}
}
@@ -0,0 +1,13 @@
package com.alibaba.dubbo.test.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
* Created by ken.lj on 2017/9/10.
*/
@Configuration
@ImportResource(locations = {"classpath:dubbo-common.xml", "classpath:dubbo-${spring.profiles.active}.xml"})
public class DubboConfiguration {

}
@@ -0,0 +1,50 @@
package com.alibaba.dubbo.test.dto;

import java.io.Serializable;

/**
* Created by ken.lj on 2017/9/8.
*/
public class Bait implements Serializable {
private int id;

private boolean cook ;

private String taste;

Bait() {}

Bait(int id, String taste) {
this(id, false, taste);
}

Bait(int id, boolean cook, String taste) {
this.id = id;
this.cook = cook;
this.taste = taste;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public boolean isCook() {
return cook;
}

public void setCook(boolean cook) {
this.cook = cook;
}

public String getTaste() {
return taste;
}

public void setTaste(String taste) {
this.taste = taste;
}
}
@@ -0,0 +1,28 @@
package com.alibaba.dubbo.test.dto;

import java.io.Serializable;

/**
* Created by ken.lj on 2017/9/24.
*/
public class Bean implements Serializable {
private int id;

private String name;

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,7 @@
package com.alibaba.dubbo.test.dto;

/**
* Created by ken.lj on 2017/9/8.
*/
public enum Taste {
}
@@ -0,0 +1,8 @@
package com.alibaba.dubbo.test.service;

/**
* Created by ken.lj on 2017/9/19.
*/
public interface AnnotateService {
String sayHello();
}