-
Notifications
You must be signed in to change notification settings - Fork 52
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
1 parent
1433faa
commit e2e1fa2
Showing
7 changed files
with
144 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.training.dubbo.dto; | ||
|
||
import java.io.Serializable; | ||
|
||
public class DubboDemoDto implements Serializable { | ||
|
||
public DubboDemoDto() { | ||
super(); | ||
} | ||
|
||
public DubboDemoDto(Integer id, String name) { | ||
super(); | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
private Integer id; | ||
|
||
private String name; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/training/dubbo/service/DubboDemoService.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,13 @@ | ||
package com.training.dubbo.service; | ||
|
||
import java.util.List; | ||
|
||
import com.training.dubbo.dto.DubboDemoDto; | ||
|
||
public interface DubboDemoService { | ||
|
||
public DubboDemoDto getDubboDemoDto(); | ||
|
||
public List<DubboDemoDto> findAllDubboDemoDto(); | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/training/dubbo/service/impl/DubboDemoServiceImpl.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,24 @@ | ||
package com.training.dubbo.service.impl; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.training.dubbo.dto.DubboDemoDto; | ||
import com.training.dubbo.service.DubboDemoService; | ||
|
||
public class DubboDemoServiceImpl implements DubboDemoService { | ||
|
||
@Override | ||
public DubboDemoDto getDubboDemoDto() { | ||
return new DubboDemoDto(1, "张三"); | ||
} | ||
|
||
@Override | ||
public List<DubboDemoDto> findAllDubboDemoDto() { | ||
List<DubboDemoDto> list = new ArrayList<DubboDemoDto>(); | ||
list.add(new DubboDemoDto(1, "张三")); | ||
list.add(new DubboDemoDto(2, "李四")); | ||
return list; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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="compute-service" /> | ||
|
||
<!-- 注册中心服务地址 --> | ||
<dubbo:registry id="zookeeper" protocol="zookeeper" address="${dubbo.registry.address}" /> | ||
|
||
<!-- 用dubbo协议在30001 --> | ||
<dubbo:protocol name="dubbo" port="30001" dispather="all" threadpool="cached" threads="5000"/> | ||
|
||
<!-- 声明需要暴露的服务接口 --> | ||
<dubbo:service interface="com.training.dubbo.service.DubboDemoService" ref="dubboDemoService" | ||
version="1.0" registry="zookeeper" owner="shp"/> | ||
|
||
<!-- 具体服务接口的实现 --> | ||
<bean id="dubboDemoService" class="com.training.dubbo.service.impl.DubboDemoServiceImpl" /> | ||
|
||
</beans> |