springboot webservice接口调用_springboot远程调用dubbo服务接口
生活随笔
收集整理的這篇文章主要介紹了
springboot webservice接口调用_springboot远程调用dubbo服务接口
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.首先idea新建一個springboot項目,這里簡單介紹下:
2.在springboot啟動類上加入注解
@ImportResource(locations = {"classpath*:dubbo_config/*.xml"})locations 為你的dubbo相關配置文件路徑
3.pom文件配置
<?xml version="1.0" encoding="UTF-8"?>4.0.0org.springframework.boot spring-boot-starter-parent 2.1.9.RELEASEcom.example demo 0.0.1-SNAPSHOTdemoDemo project for Spring Boot1.8org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test testcom.** ****-api 1.2.4com.** ****-client 1.2.4io.dubbo.springboot spring-boot-starter-dubbo RELEASEorg.apache.zookeeper zookeeper 3.4.6org.slf4j slf4j-log4j12 log4j log4j org.springframework.boot spring-boot-maven-plugin4.application name配置
<?xml version="1.0" encoding="UTF-8"?>5.controller調用
@Controllerpublic class MemberIndexController { @Autowired private DemoService demoService; /** * @RestController 相當于@Controller + @ResponseBody * 第一種啟動方式:@EnableAutoConfiguration 注解作用:掃描范圍:默認當前類里面, * SpringApplication.run(MemberController.class); * 第二種加上掃描范圍 */ @RequestMapping("/memberIndex") @ResponseBody public String memberIndex() { demoService.sayHello("SpringBoot Dubbo test"); System.out.println("memberIndex"); return "springboot成功+memberIndex"; }}總結
以上是生活随笔為你收集整理的springboot webservice接口调用_springboot远程调用dubbo服务接口的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有山水画瓷砖吗??
- 下一篇: python怎么安装pyecharts_