dubbo通过注解方式暴露服务和引用服务

(一)通过注解方式配置服务暴露,dubbo注解只会在spring bean中被识别

package org.jstudioframework.dubbo.demo.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import org.jstudioframework.dubbo.demo.service.ProviderService;
import org.springframework.stereotype.Component;

/**
 * 提供者,service实现层
 */
@Component("providerService")
@Service(version="1.0")
public class ProviderServiceImpl implements ProviderService {
    public String sayHello(String name) {
        return "***** OH , My God!~~~~" + name + ",天下无敌,唯我独尊~~~~!!! *****";
    }
}

Component是Spring bean注解,Service是dubbo的注解(不要和spring bean的service注解弄混)







二。 注解配置方式引用

你可能感兴趣的:(Dubbo)