增加dubbo配置和调用案例
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
package cn.iocoder.yudao.server;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package}
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"${yudao.info.base-package}.server", "${yudao.info.base-package}.module",
|
||||
"co.yixiang", "com.zsw.erp"
|
||||
})
|
||||
@EnableDubbo
|
||||
public class YudaoServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
ApplicationHome home = new ApplicationHome(YudaoServerApplication.class);
|
||||
File jarFile = home.getSource();
|
||||
String dirPath = jarFile.getParentFile().toString();
|
||||
String filePath = dirPath + File.separator + ".dubbo";
|
||||
System.out.println(filePath);
|
||||
|
||||
System.setProperty("dubbo.meta.cache.filePath", filePath);
|
||||
System.setProperty("dubbo.mapping.cache.filePath",filePath);
|
||||
|
||||
SpringApplication.run(YudaoServerApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@@ -203,3 +203,15 @@ justauth:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
||||
|
||||
dubbo:
|
||||
registry:
|
||||
id: zsw-farm
|
||||
address: 192.168.10.250:8848
|
||||
protocol: nacos
|
||||
username: nacos
|
||||
password: nacos
|
||||
|
||||
application:
|
||||
name: zsw-farm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user