Bootstrap.yml не найден / не прочитан в приложении Spring Boot 2, развернутом на Tomcat - PullRequest
2 голосов
/ 24 сентября 2019

Я пытаюсь развернуть приложение Spring Boot 2 на сервере Tomcat.Я уже сделал 3 шага, которые я нашел в нескольких документах, а именно:

  • Расширение с SpringBootServletInitializer
  • Пометить встроенный контейнер сервлета как предоставленный.
  • Обновить упаковку до войны

Проблема, с которой я столкнулся, заключается в том, что, похоже, файл bootstrap yml (который работает, если я запускаю приложение как автономный), помещенный в src/main/resources, не являетсяиспользовался.Независимо от того, что я положил на bootstrap.yml, приложение всегда пытается получить конфигурацию из http://localhost:8888

17: 35: 54.193 [localhost-startStop-16] INFO oscccConfigServicePropertySourceLocator - извлечение конфигурации изсервер по адресу: http://localhost:8888

17: 35: 54.292 [localhost-startStop-16] INFO oscccConfigServicePropertySourceLocator - исключение тайм-аута подключения по URL - http://localhost:8888. будет пытаться использовать следующий URL-адрес, если он доступен

17: 35: 54.293 [localhost-startStop-16] WARN oscccConfigServicePropertySourceLocator - Не удалось обнаружить PropertySource: ошибка ввода-вывода при запросе GET для "http://localhost:8888/application/default": Соединение отклонено; вложенное исключение - java.net.ConnectException:Отказ в соединении 1

Я прочитал в другом потоке, что мне нужна зависимость spring-cloud-starter-config от pom, но я могу заверить, что она у меня есть.

Вот начальная загрузка.yml Я использую:

spring:
    application:
        name : botbrowser
    cloud:
        config:
            uri: http://isblvdivrrd0003:8080     # config-server url
            profile: ukdev                          # environment
            label: master 
            failFast: true
            overrideNone: false
            overrideSystemProperties: true 
            enabled: true
            allowOverride: true
            retry:                                # connection retrials configuration
                initialInterval: 1000             # first timeout
                multiplier: 1.5                   # factor for subsequence trials (1st trial = initialInterval, 2nd trial = 1st trial * multiplier, ...)
                maxAttempts: 6                    # number of trials
                maxInterval: 5000                 # maximal timeout

Есть идеи о том, что может произойти?

Редактировать:

Включая сборку из pom

<build>
<finalName>botbrowser</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.surefire</groupId>
                    <artifactId>surefire-junit4</artifactId>
                    <version>2.22.0</version>
                </dependency>
            </dependencies>
            <configuration>
                <includes>
                    <include>**/*.java</include>
                </includes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>pre-unit-test</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <destFile>${project.build.directory}/jacoco.exec</destFile>
                        <propertyName>surefireArgLine</propertyName>
                    </configuration>
                </execution>
                <execution>
                    <id>post-unit-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <dataFile>${project.build.directory}/jacoco.exec</dataFile>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <executions>
                <execution>
                    <id>get-the-git-infos</id>
                    <goals>
                        <goal>revision</goal>
                    </goals>
                    <!-- <phase>initialize</phase> -->
                </execution>
                <execution>
                    <id>validate-the-git-infos</id>
                    <goals>
                        <goal>validateRevision</goal>
                    </goals>
                    <!-- <phase>package</phase> -->
                </execution>
            </executions>
            <configuration>
                <failOnNoGitDirectory>false</failOnNoGitDirectory>
                <generateGitPropertiesFile>true</generateGitPropertiesFile>
                <generateGitPropertiesFilename>
                    ${project.build.outputDirectory}/git.properties
                </generateGitPropertiesFilename>
                <verbose>false</verbose>
            </configuration>
        </plugin>
    </plugins>
</build>

Большое спасибо заранее

1 Ответ

0 голосов
/ 24 сентября 2019

проверьте, исключен ли bootstrap.yml из jar / war из сборки gradle

...