SOFABoot quick start documentation issue
See original GitHub issueI walked through the SOFABoot quick start guides and have some suggestions.
1. It’s not always easy to change the parent pom, so it’s better to document an alternative way, e.g. import the sofaboot-dependencies
in dependencyManagement
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>${sofa.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
2. XML configuration is not widely used now, we’d better update the quick start documents using annotation examples
3. The annotation should be more user friendly
Take the example below:
- after the
@SofaService
is annotated, the@Component
should not be necessary - The
interfaceType
is not mandatory, our sample could remove it - It’s not good to let users specify binding type as string, it’s better to provide some enums for bindings.
@SofaService(interfaceType = HelloSyncService.class, bindings = {@SofaServiceBinding(bindingType = "bolt")})
@Component
public class HelloSyncServiceImpl implements HelloSyncService {
...
}
4. Registry instructions should be added in the quick start doc
Currently there is no such instruction, so the user could not run the demo following the quick start doc from scratch.
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Quick start guide for SOFABoot project - SOFAStack
Create a new Spring Boot application (In case of SOFABoot project, import to SOFABoot as described in SOFABoot Documentation - Dependency Management.
Read more >SOFABoot: Open Source Java Development Framework Based on ...
To address the above issues while maintaining the advantages of Spring Boot, ... Please refer to SOFAStack Documentation for SOFABoot quick start guide....
Read more >Spring Boot Java quick start :: Documentation - OptaPlanner
A student dislikes sequential lessons on the same subject. Mathematically speaking, school timetabling is an NP-hard problem. This means it is difficult to ......
Read more >README.md · SOFAStack/sofa-boot - Gitee.com
Please refer to SOFAStack Documentation for SOFABoot quick start guide. Demos. Some SOFABoot demo projects to get your hands dirty: Class Isolation ·...
Read more >Apache ShenYu document
As showing picture below,shenyu-admin will issue a configuration change ... This article introduces how to quick start the Apache ShenYu ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
一开始我想认领这个
@SofaService
的任务。我的想法是,
可以参考 Dubbo 的
ServiceAnnotationPostProcessor
如何做的BeanDefinitionRegistryPostProcessor
接口,实现postProcessBeanDefinitionRegistry
方法 在这个方法内部来做扫描,注册到 Spring 容器中 的 BeanClassPathBeanDefinitionScanner#scan(String...)
方法可以扫描出来 Bean, 然后注册到容器中扫描要实现,对对应的包进行扫描。有两种实现方式。
如何拿到 扫描
@SofaService
的 scanerPackageList 可以参考https://github.com/Nepxion/Discovery/blob/6.x.x/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/extractor/StrategyPackagesExtractor.java
内部使用AutoConfigurationPackages#get(BeanFactory)
拿到了 scan 的包的列表org.springframework.boot.autoconfigure.AutoConfigurationPackages
类在,Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.9.RELEASE
, 对应模块 并没有依赖,导致没有办法用dubbo 的 xml 配置里边有
dubbo:basePackages
扫描包,annotation 有@EnableDubbo#scanBasePackages
,所以如果要这个东西如何配置进去,还是一个问题 …其实我比较倾向于 用
AutoConfigurationPackages#get(BeanFactory)
返回List<String>
来做统一的抽象,这样子,更加统一一点,毕竟要做开源统一可以讨论一下是否可以添加对应的依赖,然后,这个方案是否可以尝试着做一下的必要。😄 @EvenLjj E @seeflood
至于说用组合注解的方式的话,和 Spring 绑定的太深了。
@EvenLjj
扫描注解没有是前提
这里是通过
@Service
注册到 Spring 容器中,然后 每一个 Bean 都去进行看一下是否发布 Sofa服务所以,是没有缺失了先扫描
@SofaService
的过程 ~~~BeanFactoryPostProcessor#postProcessBeanFactory
的这个,是注册到容器才会触发的。所以,扫描注解没有 … …旧方法
以前的方法
@Service
注册到 容器 , 从容器中拿出来,遍历,发布 SOFA 服务。新方式
扫描
@SofaService
注册容器, <font color=red>这一步才是难点。</font>直到这个,才能到我的提出的需要扫描 包的方案,继续往下讨论。
所以,前提是去掉
@Service
的自动注册到 Spring 容器,增加@SofaService
的自动注册到 Spring 容器