Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions dubbo-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@
<groupId>com.coderqian</groupId>
<artifactId>dubbo-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
16 changes: 15 additions & 1 deletion dubbo-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ dubbo.application.id=dubbo-api
# 当前dubbo应用名称
dubbo.application.name=dubbo-api
# 注册中心
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.registry.timeout=60000
dubbo.registry.group=dubbo
dubbo.registry.check=false

dubbo.server=true
# 生产者暴露给消费者协议
dubbo.protocol.name=dubbo
# 生产者暴露给消费者端口
dubbo.protocol.port=20880

#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://127.0.0。1:3306/test?useUnicode=true&characterEncoding=utf8&verifyServerCertificate=false&useSSL=false&useOldAliasMetadataBehavior=true
#spring.datasource.username=
#spring.datasource.password=
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.coderqian.dubboconsumer;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@EnableDubbo
@SpringBootApplication
//@ImportResource({"classpath:dubbo/dubbo-customer.xml"})
public class DubboConsumerApplication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@RequestMapping("/test")
public class TestController {

@Reference
@Reference(version = "1.0.0", timeout = 5000, interfaceClass = TestService.class, check = false)
private TestService testService;

@HystrixCommand(fallbackMethod = "testError")
Expand Down
18 changes: 12 additions & 6 deletions dubbo-core/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spring.application.name=dubbo-core
server.port=8020
server.port=3000

# 当前dubbo应用id
dubbo.application.id=dubbo-core
Expand All @@ -17,13 +17,19 @@ dubbo.protocol.name=dubbo
# 生产者暴露给消费者端口
dubbo.protocol.port=20880

logging.config=classpath:log4j2.xml
# Mybatis配置
mybatis.type-aliases-package=com.coderqian.dubbocore.model.entity
mybatis.type-handlers-package=com.coderqian.dubbocore.mapper
mybatis.mapper-locations=classpath:mapper/*.xml

spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
# 配置数据源
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.initialSize=5
spring.datasource.minIdle=5
spring.datasource.maxActive=20
spring.datasource.maxActive=20

spring.datasource.url=jdbc:mysql://127.0.0。1:3306/test?useUnicode=true&characterEncoding=utf8&verifyServerCertificate=false&useSSL=false&useOldAliasMetadataBehavior=true
spring.datasource.username=root
spring.datasource.password=qlq1995/
4 changes: 2 additions & 2 deletions dubbo-core/src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.coderqian.dubboprovider.mapper.UserMapper">
<mapper namespace="com.coderqian.dubbopcore.mapper.UserMapper">
<sql id="select">
id id,
name name,
Expand All @@ -11,7 +11,7 @@
user
</sql>

<select id="findAll" resultType="com.coderqian.dubboprovider.model.entity.UserEntity">
<select id="findAll" resultType="com.coderqian.dubbocore.model.entity.UserEntity">
select
<include refid="select"/>
from
Expand Down
43 changes: 42 additions & 1 deletion dubbo-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,50 @@
<dependencies>
<dependency>
<groupId>com.coderqian</groupId>
<artifactId>dubbo-service</artifactId>
<artifactId>dubbo-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.13</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.coderqian.dubboservice.service.impl;
package com.coderqian.dubboprovider.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.coderqian.dubboapi.service.TestService;
import com.coderqian.dubbocore.mapper.UserMapper;
import com.coderqian.dubbocore.model.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;

Expand All @@ -14,11 +13,11 @@
* mail: qianlq0824@gmail.com
*/

@Service
@Service(version = "1.0.0", timeout = 5000, interfaceClass = TestService.class)
public class TestServiceImpl implements TestService {

@Autowired
private UserMapper userMapper;
private TestService testService;


// @HystrixCommand(commandProperties = {
Expand All @@ -32,6 +31,6 @@ public String test(String text) {

@Override
public List<UserEntity> testMybatis(String text) {
return userMapper.findAll();
return testService.testMybatis("测试");
}
}
4 changes: 1 addition & 3 deletions dubbo-provider/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ dubbo.server=true
# 生产者暴露给消费者协议
dubbo.protocol.name=dubbo
# 生产者暴露给消费者端口
dubbo.protocol.port=20880

logging.config=classpath:log4j2.xml
dubbo.protocol.port=20880
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:protocol name="dubbo" port="20880"/>

<dubbo:service interface="com.coderqian.dubboapi.service.TestService" ref="testService" retries="3" timeout="6000"/>
<bean id="testService" class="com.coderqian.dubboservice.service.impl.TestServiceImpl"/>
<bean id="testService" class="com.coderqian.dubboprovider.service.impl.TestServiceImpl"/>

</beans>
81 changes: 0 additions & 81 deletions dubbo-service/pom.xml

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions dubbo-service/src/main/resources/application.properties

This file was deleted.

Loading