Issue 1:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.6.2

Operating System version: win 10, spring-boot 1.5.9.RELEASE

Java version: 1.8

Steps to reproduce this issue

Java config

@Configuration
public class HttpConfig {

@Bean
RestTemplate restTemplate(){
RestTemplate restTemplate = new RestTemplate();
return restTemplate;
}
}

Dubbo Service config

@Configuration
public class CanaryConfig {

private Logger logger = LoggerFactory.getLogger(CanaryConfig.class);

@Autowired
private ApplicationConfig application;
@Autowired
private RegistryConfig registry;
@Autowired
private ProtocolConfig protocol;

@PostConstruct
public void init() {
logger.info("CanaryConfig init ...");
// 服务提供者暴露服务配置

// 此实例很重，封装了与注册中心的连接，请自行缓存，否则可能造成内存和连接泄漏
ServiceConfig<CanaryService> service = new ServiceConfig<>();
service.setApplication(application);
// 多个注册中心可以用setRegistries()
service.setRegistry(registry);
// 多个协议可以用setProtocols()
service.setProtocol(protocol);
service.setInterface(CanaryService.class);
service.setRef(new CanaryServiceImpl());
service.setFilter("tracing,dubboInterfaceAuthorityFilter,dubboLogFilter");
// 如果不延迟暴露, 则filter无法进入setter来获取spring实例
// service.setDelay(5000);

// 暴露及注册服务
service.export();
}

}

Dubbo filter(in another dependency jar)

@Activate(group = {Constants.PROVIDER, Constants.CONSUMER})
public class DubboInterfaceAuthorityFilter implements Filter {
private static final Logger logger = LoggerFactory.getLogger(DubboInterfaceAuthorityFilter.class);

public void setRestTemplate(RestTemplate restTemplate) {
// get restTemplate instance from spring
logger.info(" into setter");
}

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if(restTemplate!=null){
// my code
}
// ...
}
}

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

DubboInterfaceAuthorityFilter can invoke its setRestTemplate method, to get restTemplate instance from spring

Actual Result

DubboInterfaceAuthorityFilter do not invoke setRestTemplate method, so that restTemplate is always null in my filter.

By the way

If i service.setDelay(5000); or export this service by dubbo xml:

<dubbo:service interface="com.canary.service.CanaryService" ref="canaryServiceImpl" version="1.0.3"/>
<bean id="canaryServiceImpl" class="com.canary.service.CanaryServiceImpl"/>

DubboInterfaceAuthorityFilter will invoke its setRestTemplate method.

Why ?

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.3-SNAPSHOT

Operating System version: macOs

Java version: JDK 1.8

Steps to reproduce this issue

We cannot getFuture from alibaba RpcContext after setFuture, the result is null.

CompletableFuture future = new CompletableFuture();
com.alibaba.dubbo.rpc.RpcContext.getContext().setFuture(future);
Future result = com.alibaba.dubbo.rpc.RpcContext.getContext().getFuture();

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

result should be same new FutureAdapter(future);

Actual Result

result is null.

If there is an exception, please attach the exception trace:

Just put your stack trace here!