Archetype Created Web ApplicationcontextConfigLocationclasspath:applicationContext*.xmlorg.springframework.web.context.ContextLoaderListener
(3)创建服务接口
package com.codecow.service;
public interface HelloService {
public String sayHello(String name);
}
(4)创建服务实现类
package com.codecow.service.impl;
import com.alibaba.dubbo.config.annotation.Service;
import com.codecow.service.HelloService;
@Service
public class HelloServiceImpl implements HelloService {
public String sayHello(String name) {
return "hello " + name;
}
}
注意:
服务实现类上使用的Service注解是Dubbo提供的,用于对外发布服务
服务实现类上使用的Service注解是Dubbo提供的,用于对外发布服务
服务实现类上使用的Service注解是Dubbo提供的,用于对外发布服务
tomcat7:run
服务提供者完成
2 服务消费方开发
开发步骤:
(1)创建maven工程(打包方式为war)名称为:dubbodemo_consumer
pom.xml配置和上面服务提供者相同,只需要将Tomcat插件的端口号改为8082即可
(2)配置web.xml文件
Archetype Created Web Applicationspringmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:applicationContext-web.xml1springmvc*.do