Telegrambost springboot mapping starter#1493
Telegrambost springboot mapping starter#1493taragrammatonn wants to merge 20 commits intorubenlagus:devfrom
Conversation
…agus#1482) Co-authored-by: Ruben Bermudez <rubenlagus@users.noreply.github.com>
…1475) Co-authored-by: Ruben Bermudez <rubenlagus@users.noreply.github.com>
Fixed brackets on javadoc to show properly Co-authored-by: Ruben Bermudez <rubenlagus@users.noreply.github.com>
yvasyliev
left a comment
There was a problem hiding this comment.
If the whole change is about Bot Command mapping, I would name the module and related classes more specifically (e.g. telegrambots-springboot-longpolling-command-starter)
| @Bean | ||
| @ConditionalOnMissingBean | ||
| public OkHttpClient okHttpClient() { | ||
| return new OkHttpClient(); | ||
| } |
There was a problem hiding this comment.
Why is OkHttpClient bean created but never used?
| } | ||
|
|
||
| @Bean | ||
| public SpringLongPollingBot springLongPollingBot(TelegramBotProperties properties, |
There was a problem hiding this comment.
I would add @ConditionalOnMissingBean for extension opportunity
| @Bean | ||
| @ConditionalOnMissingBean(TelegramBotsLongPollingApplication.class) | ||
| public TelegramBotsLongPollingApplication telegramBotsApplication() { | ||
| return new TelegramBotsLongPollingApplication(); | ||
| } | ||
|
|
||
| @Bean | ||
| @ConditionalOnMissingBean | ||
| public TelegramBotInitializer telegramBotInitializer(TelegramBotsLongPollingApplication telegramBotsApplication, | ||
| ObjectProvider<List<SpringLongPollingBot>> longPollingBots) { | ||
| return new TelegramBotInitializer(telegramBotsApplication, | ||
| longPollingBots.getIfAvailable(Collections::emptyList)); | ||
| } |
There was a problem hiding this comment.
Since telegrambots-springboot-longpolling-starter is transitively included into into telegrambost-springboot-mapping-starter, no need to define TelegramBotsLongPollingApplication & TelegramBotInitializer beans explicitly
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter</artifactId> | ||
| </dependency> |
There was a problem hiding this comment.
spring-boot-starter dependency is redundant in this module
There was a problem hiding this comment.
- Missing
valueattribute. - I believe the alias should be
commandsinstead ofcommand.
| BotRequestMapping annotation = AnnotationUtils.findAnnotation(method, BotRequestMapping.class); | ||
| if (annotation != null) { | ||
| for (String command : annotation.value()) { | ||
| handlers.put(command, new BotHandlerMethod(bean, method)); |
There was a problem hiding this comment.
Should we check if a method has exactly one parameter of Update?
There was a problem hiding this comment.
Please remove unused/duplicated imports
| } | ||
|
|
||
| public void handleUpdate(Update update) { | ||
| if (update.hasMessage() && update.getMessage().hasText()) { |
| <version>8.2.0</version> | ||
| </parent> | ||
|
|
||
| <artifactId>telegrambost-springboot-mapping-starter</artifactId> |
52a184e to
9203912
Compare
No description provided.