wzhangNJ opened a new issue, #4157:
URL: https://github.com/apache/shenyu/issues/4157
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
hi,
shgenyu: 2.5.0
dubbo:2.6.2
issue:
Map<String, ServiceBean> serviceBean =
contextRefreshedEvent.getApplicationContext().getBeansOfType(ServiceBean.class);
serviceBean.size() = 0
```
public void onApplicationEvent(@NonNull final ContextRefreshedEvent
contextRefreshedEvent) {
if (!registered.compareAndSet(false, true)) {
return;
}
// Fix bug(https://github.com/apache/shenyu/issues/415), upload
dubbo metadata on ContextRefreshedEvent
Map<String, ServiceBean> serviceBean =
contextRefreshedEvent.getApplicationContext().getBeansOfType(ServiceBean.class);
for (Map.Entry<String, ServiceBean> entry : serviceBean.entrySet()) {
handler(entry.getValue());
}
serviceBean.values()
.stream()
.findFirst()
.ifPresent(bean ->
publisher.publishEvent(buildURIRegisterDTO(bean)));
}
```
### Expected Behavior
Feign used,ContextRefreshedEvent is created multiple times.
```
if (!registered.compareAndSet(false, true)) {
return;
}
```
SpringApplicationContext may not be triggered.
```
public void onApplicationEvent(@NonNull final ContextRefreshedEvent
contextRefreshedEvent) {
// Fix bug(https://github.com/apache/shenyu/issues/415), upload
dubbo metadata on ContextRefreshedEvent
Map<String, ServiceBean> serviceBean =
contextRefreshedEvent.getApplicationContext().getBeansOfType(ServiceBean.class);
for (Map.Entry<String, ServiceBean> entry : serviceBean.entrySet()) {
handler(entry.getValue());
}
serviceBean.values()
.stream()
.findFirst()
.ifPresent(bean ->
publisher.publishEvent(buildURIRegisterDTO(bean)));
}
```
### Steps To Reproduce
_No response_
### Environment
```markdown
ShenYu version(s):2.6.0
```
### Debug logs
_No response_
### Anything else?
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]