3

springboot+dubbo+ zookeeper 注册中心用注解方式死活注册不进去,用xml方式可以完成

 2 years ago
source link: https://www.oschina.net/question/2286478_2324714
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

springboot+dubbo+ zookeeper 注册中心用注解方式死活注册不进去,用xml方式可以完成

噗哈哈哈嗝 发布于 昨天 19:09
<description>dubbo服务提供者配置</description>
<context:property-placeholder location="classpath:application.properties"/>
<dubbo:application name="${dubbo.application.name}"/>
<dubbo:registry address="${dubbo.registry.address}" file="${dubbo.registry.file}"/>
<dubbo:protocol name="dubbo" port="${dubbo.protocol.port}"/>
<dubbo:provider version="${dubbo.provider.version}" timeout="50000" />
<!-- 扫描注解包路径,多个包用逗号分隔,不填pacakge表示扫描当前ApplicationContext中所有的类 -->
<dubbo:annotation package="com.platform.service.impl"/>
<!-- 要暴露的服务接口 -注解配置无效使用下列方式 -->
<!-- <dubbo:service interface="com.platform.service.IAttachments" ref="attachmentsImpl" />

配置代码如上,用xml的方式没问题,可以在dubboadmin中查看到,但是用注解的方式就不行,不知道什么原因,有大佬可以service实现代码如下:

@com.alibaba.dubbo.config.annotation.Service
@org.springframework.stereotype.Service
public class AttachmentsImpl implements IAttachments {
	@Autowired
	private AttachmentsDAO<Attachments> attchmentDAO;
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK