技术标签: dubbo
<!-- dubbo依赖-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.8</version>
</dependency>
<!-- 注册中心使用的是zookeeper,引入操作zookeeper的客户端 -->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>5.1.0</version>
</dependency>
创建provider.xml文件。
<?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="user-service-provider"></dubbo:application>
<!-- 指定注册中心的位置-->
<dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry>
<!-- 指定通信规则(通信协议、通信端口)-->
<dubbo:protocol name="dubbo" port="20080"></dubbo:protocol>
<!-- 暴露服务 ref指向服务真正实现-->
<dubbo:service interface="com.buba.service.UserService" ref="UserServiceImpl"></dubbo:service>
<bean id="UserServiceImpl" class="com.buba.service.impl.UserServiceImpl"></bean>
</beans>
编写测试代码:
package com.buba;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Provider {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"provider.xml"});
context.start();
System.in.read(); // 按任意键退出
}
}
启动zookeeper服务,然后启动zookeeper客户端,最后执行测试代码。
登录监控中心查看:
<!-- dubbo依赖-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.8</version>
</dependency>
<!-- 注册中心使用的是zookeeper,引入操作zookeeper的客户端 -->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>5.1.0</version>
</dependency>
<?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="order-service-consumer"></dubbo:application>
<!-- 指定注册中心的位置-->
<dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry>
<!-- 声明需要调用远程服务的接口,生成远程服务代理-->
<dubbo:reference interface="com.buba.service.UserService" id="userService"></dubbo:reference>
<bean class="com.buba.service.impl.OrderServiceImpl" id="orderServiceImpl">
<property name="userService" ref="userService"></property>
</bean>
</beans>
package com.buba.service.impl;
import com.buba.pojo.UserAddress;
import com.buba.service.OrderService;
import com.buba.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class OrderServiceImpl implements OrderService {
private UserService userService;
@Override
public void initOrder(String userId) {
List<UserAddress> userAddressList = userService.getUserAddressList("1");
userAddressList.forEach(System.out::println);
}
public void setUserService(UserService userService) {
this.userService = userService;
}
}
package com.buba.controller;
import com.buba.service.OrderService;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("consumer.xml");
OrderService bean = classPathXmlApplicationContext.getBean(OrderService.class);
bean.initOrder("1");
System.in.read();
}
}
在监控中心可以看到服务关系。
脉搏文库 TideSec本专题文章导航1、远控免杀专题文章(1)-基础篇:https://www.secpulse.com/archives/123295.html因为cobaltstrike生成payload比较简单,这里不再累述,只是介绍一下msfvenom的基本参数和一些小技巧。本节目录如下:msfvenom简介msfvenom是msfpayload和msfencode的结合体,于2015年6月8日取代了msfpayload和msfencode。在此之后,metasploit-fram
思考并行运算的代码块中,是计算密集型的。因为计算的时间复杂度比较高,跑每一个例子会耗费几天的时间。因此不存在所谓活少人多的问题。1.是否是进程优先级的问题答案为否,因为个进程优先级一致,而每个进程所需的内存量和计算量基本一致,所需运行时间也接近的。2.是否是代码层面的问题答案为否,因为可以看到已经有台机器可以正常的按照意图来跑。3.是否是机器的问题答案有可能,那究竟是机器的什么问题呢?在一台21核...
转换方法using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml.Serialization;namespace WindowsFormsAppl...
Option Explicit Dim sRestTime As LongDim dblDownloadSpeed As LongDim FileHeaderLen As LongDim StartPos As LongDim FileSizeByte As LongDim SaveFileName As StringDim StartTime As VariantDim Fil
原因分析1.读取的是.png 图片 是32位深度的,一般我们读取的是.jpg 24位深度的2.转换为RGB就行了test_image = Image.open(test_image_name).convert('RGB')
iOS storyboard 任意使用static tableViewiOS的布局中,可以使用 static tableView cell即无需编程,直在在sb中一个一个画出cell的布局来,这是真正的所见即所得。这种方法在UITableViewController 对应的窗口很好用,但是如果你想美化一下界面,比如想把TableView 加入到另一个View中,上下加点标题之类美化
参考来源将列中的重复索引删除pro_data.columns = pro_data.columns.droplevel(0)使用reset_index()将行的多重索引去除但是此时name和glass_id仍为索引pro_data = pd.concat([pro_data,pd.DataFrame(data=pro_data.index.tolist(),columns=[p...
1. logging日志的介绍在现实生活中,记录日志非常重要,比如:银行转账时会有转账记录;飞机飞行过程中,会有个黑盒子(飞行数据记录器)记录着飞机的飞行过程,那在咱们python程序中想要记录程序在运行时所产生的日志信息,怎么做呢?可以使用 logging 这个包来完成记录程序日志信息的目的是:1. 可以很方便的了解程序的运行情况2. 可以分析用户的操作行为、喜好等信息3. 方便开发人员检查bu...
1.软件准备2. 依次按装软件rpm -ivherlang-22.0.7-1.el6.x86_64.rpmrpm -ivhsocat-1.7.3.2-2.el7.x86_64.rpmrpm -ivhrabbitmq-server-3.7.17-1.el7.noarch.rpm3. 启动rabbitmqsudo service rabbitmq-server start4.管理账号sudo rabbitmqctl add_user admin admin...
参考文章:http://blog.csdn.net/xb12369/article/details/40543649/http://www.runoob.com/java/java-url-processing.html有时候我们需要从网络或者资源服务器等外部非本地环境下载文件,这就需要我们通过URL来访问地址。URL(Uniform Resource Locator)中文名为
p0#include<cmath>#include<eigen3/Eigen/Core>#include<eigen3/Eigen/Dense>#include<iostream>Eigen::Vector4f getPoint(Eigen::Vector4f point, float rotate, Eigen::Vector4f transform){ Eigen::Matrix4f rotate_matrix, trans_matr
代码:import android.annotation.SuppressLint;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.os.Handler;import android.os.Message;import android.util.AttributeS