Skip to content

Commit

Permalink
fix 305 (#306)
Browse files Browse the repository at this point in the history
* fix 305

* fix-305
  • Loading branch information
kexianjun authored and nzomkxia committed Feb 18, 2019
1 parent 9f7aeea commit 5bc0e33
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,26 @@

@Component
public class GenericServiceImpl {

private ReferenceConfig<GenericService> reference;

private ApplicationConfig applicationConfig;
@Autowired
private Registry registry;

@PostConstruct
public void init() {
reference = new ReferenceConfig<>();
reference.setGeneric(true);

RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress(registry.getUrl().getProtocol() + "://" + registry.getUrl().getAddress());

ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-admin");
applicationConfig.setRegistry(registryConfig);

reference.setApplication(applicationConfig);
}

public Object invoke(String service, String method, String[] parameterTypes, Object[] params) {

ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
reference.setGeneric(true);
reference.setApplication(applicationConfig);
reference.setInterface(service);
GenericService genericService = reference.get();
return genericService.$invoke(method, parameterTypes, params);
Expand Down

0 comments on commit 5bc0e33

Please sign in to comment.