feign 改为 dubbo
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
package com.czg;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.czg.service.system.mapper")
|
||||
@EnableDubbo
|
||||
public class SystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.czg.controller;
|
||||
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.SysParamsDTO2;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -12,8 +17,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/admin/feign")
|
||||
public class FeignController {
|
||||
|
||||
@Resource
|
||||
private SysParamsService sysParamsService;
|
||||
|
||||
@RequestMapping("/testCall/{name}")
|
||||
public String testCall(@PathVariable String name) {
|
||||
return "system-server:" + name;
|
||||
public CzgResult<SysParamsDTO2> testCall(@PathVariable String name) {
|
||||
return CzgResult.success(new SysParamsDTO2().setParamCode("system-server:" + name));
|
||||
}
|
||||
|
||||
@GetMapping("/sysParam/code/{code}")
|
||||
public SysParamsDTO getParamsByCode(@PathVariable String code) {
|
||||
CzgResult<SysParamsDTO> paramsByCode = sysParamsService.getParamsByCode(code);
|
||||
return paramsByCode.getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.czg.controller;
|
||||
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.czg.service.system.service.SysParamsService;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@@ -24,3 +24,15 @@ spring:
|
||||
discovery:
|
||||
server-addr: 101.37.12.135:8848
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: system-server
|
||||
qos-port: 22224
|
||||
qos-enable: true
|
||||
registry:
|
||||
address: nacos://101.37.12.135:8848 # Nacos 服务地址
|
||||
group: server
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
protocol:
|
||||
port: 9401
|
||||
|
||||
Reference in New Issue
Block a user