Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DubboComponentScan cannot backward support for alibaba @Service and @Reference. #4330

Closed
2 tasks done
haiyang1985 opened this issue Jun 18, 2019 · 2 comments
Closed
2 tasks done
Assignees
Labels
type/bug Bugs to being fixed
Milestone

Comments

@haiyang1985
Copy link
Member

haiyang1985 commented Jun 18, 2019

  • 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.2
  • Operating System version: macOs
  • Java version: JDK 1.8

Steps to reproduce this issue

  1. Currently, my dubbo service is beyond 2.5.10, and going to upgrade 2.7.2. The build system errors me that DubboComponentScan is not exists in alibaba package, then select to auto-import apache one.
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
@SpringBootApplication
@DubboComponentScan
public class ServiceInitializer extends SpringBootServletInitializer {
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(ServiceInitializer.class);
  }
}
  1. I have forgot to switch @service from alibaba to apache one. The IDE's alert doesn't obviously, and build system doesn't stop the build.
import com.alibaba.dubbo.config.annotation.Service;
@Service
public class DemoServiceImpl implements DemoService {
  @Override
  public String sayHello(String name) {
    return "welcome,"+name;
  }
}
  1. The application is running without error message, but service have not been started.

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

Expected Result

The DubboComponentScan should backward compatible with alibaba @service and @reference.

Actual Result

It's incompatible with alibaba @service and @reference.

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

The service have not thrown any exception, consumer will throw no provider exception as service not started.

@chickenlj chickenlj added this to the 2.7.3 milestone Jun 18, 2019
@chickenlj chickenlj added the type/bug Bugs to being fixed label Jun 18, 2019
@kaori-seasons
Copy link
Contributor

Is it because @DubboComponentScan scans into the context that the class declared by @service is not injected? Recently watching

@cvictory
Copy link
Contributor

cvictory commented Jun 19, 2019

I think you have introduced dubbo-compatible jar.

And I think If you want to keep @service and @reference in com.alibaba package, you can put @CompatibleDubboComponentScan together with @DubboComponentScan.

If you still have some problem, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

5 participants