upgrade spring boot to 2.2.0.RELEASE

replaced Optional bean with ObjectProvider in autoconfiguration
This commit is contained in:
sokomishalov 2019-10-30 12:16:16 +03:00
parent fc12de81c0
commit eb3d159dde
2 changed files with 11 additions and 11 deletions

View File

@ -70,7 +70,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
<spring-boot.version>2.2.0.RELEASE</spring-boot.version>
</properties>
<dependencies>

View File

@ -2,8 +2,9 @@ package org.telegram.telegrambots.starter;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
@ -11,7 +12,6 @@ import org.springframework.context.annotation.Configuration;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.generics.LongPollingBot;
import org.telegram.telegrambots.meta.generics.WebhookBot;
/**
* #TelegramBotsApi added to spring context as well
*/
@ -28,10 +28,10 @@ public class TelegramBotStarterConfiguration {
@Bean
@ConditionalOnMissingBean
public TelegramBotInitializer telegramBotInitializer(TelegramBotsApi telegramBotsApi,
Optional<List<LongPollingBot>> longPollingBots,
Optional<List<WebhookBot>> webHookBots) {
ObjectProvider<List<LongPollingBot>> longPollingBots,
ObjectProvider<List<WebhookBot>> webHookBots) {
return new TelegramBotInitializer(telegramBotsApi,
longPollingBots.orElseGet(Collections::emptyList),
webHookBots.orElseGet(Collections::emptyList));
longPollingBots.getIfAvailable(Collections::emptyList),
webHookBots.getIfAvailable(Collections::emptyList));
}
}