spring Sping Boot 无法识别application.properties文件

kb5ga3dv  于 2022-11-28  发布在  Spring
关注(0)|答案(9)|浏览(377)

我尝试使用Sping Boot 配置DynamoDb客户端,并将端点和配置信息放置在resources/application.properties文件中。但是,Spring Boot似乎并不拾取这些属性。它确实拾取了我存储在同一文件中的“server.default”键,因此它肯定能够识别文件本身。
下面是我的application.properties文件和我试图将属性加载到其中的类(DynamoDBClientMapper):

amazon.dynamodb.endpoint=http://localhost:8000/
amazon.dynamodb.region=us-west-1
amazon.aws.accesskey=key
amazon.aws.secretkey=key2

server.port=8080

下面是我的项目结构:

下面是我尝试加载属性的相关类。我尝试了**@PropertySource注解和EnableAutoConfiguration**,但都没有注册属性文件。

@PropertySource("database.properties")
public class DynamoClientMapper {

    @Value("${amazon.dynamodb.endpoint}")
    private String amazonDynamoDBEndpoint;

    @Value("${amazon.aws.accesskey}")
    private String amazonAWSAccessKey;

    @Value("${amazon.aws.secretkey}")
    private String amazonAWSSecretKey;

    @Value("${amazon.aws.region}")
    private String amazonAWSRegion;

这里是我的App.java:

@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class App {

//    private static final Logger logger = Logger.getLogger(App.class.toString());

    public static void main(String[] args){
        SpringApplication.run(App.class, args);
    }
}

下面是堆栈跟踪:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoClientMapper' defined in file [C:\Users\ychen4\Desktop\DiningApplication\target\classes\main\java\com\dining\dao\DynamoClientMapper.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: endpoint cannot be null
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at main.java.com.dining.App.main(App.java:18) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.2.RELEASE.jar:1.5.2.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: endpoint cannot be null
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 22 common frames omitted
Caused by: java.lang.IllegalArgumentException: endpoint cannot be null
    at com.amazonaws.util.RuntimeHttpUtils.toUri(RuntimeHttpUtils.java:182) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.util.RuntimeHttpUtils.toUri(RuntimeHttpUtils.java:171) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.AmazonWebServiceClient.toURI(AmazonWebServiceClient.java:238) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.AmazonWebServiceClient.setEndpoint(AmazonWebServiceClient.java:228) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:362) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:337) ~[aws-java-sdk-core-1.11.125.jar:na]
    at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46) ~[aws-java-sdk-core-1.11.125.jar:na]
    at main.java.com.dining.dao.DynamoClientMapper.<init>(DynamoClientMapper.java:32) ~[classes/:na]
    at main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad.<init>(<generated>) ~[classes/:na]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_121]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_121]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_121]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_121]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
    ... 24 common frames omitted

我试着创建另一个单独的database.properties文件,但是Sping Boot 也不能识别它。我做错了什么?

7d7tgy0s

7d7tgy0s1#

您可以尝试在pom.xml文件的build部分定义resources标记。设置资源目录的路径,其中是application.properties

<build>
  <resources>
    <resource>
      <directory>resources</directory>
      <targetPath>${project.build.outputDirectory}</targetPath>
      <includes>
        <include>application.properties</include>
      </includes>
    </resource>
  </resources>
</build>

资源链接:https://stackoverflow.com/a/30595114/2293534

另一种方法:

如果您使用的是spring 3.X版本,您可以添加@PropertySource("application.properties")

@Configuration
@PropertySource(value = "classpath:application.properties")
public class ApplicationConfig {

    // more configuration ...
}

如果您使用spring 4版本,则使用名为@PropertySources的新注解添加2个属性文件,该注解允许您声明重复的@PropertySource注解:

@PropertySources({
    @PropertySource("default.properties"),
    @PropertySource("overriding.properties")
})

这里给出的细节是我的另一个回答:https://stackoverflow.com/a/43659158/2293534

更新#1:

App.java类替换为以下类

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

//@SpringBootApplication
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(applicationClass);
    }

    private static Class<Application> applicationClass = Application.class;
}

对于java.io.FileNotFoundException

请使用以下

@PropertySource(value = "database.properties", ignoreResourceNotFound = true)

更新#2:

我已经按照以下步骤运行了您的应用程序。它运行成功。
1.转到pom.xml所在的项目文件夹。
1.你在pom.xml上有一些错误和警告。我已经全部澄清了。
1.打开命令提示符并运行mvn clean
1.运行mvn clean install
1.最后mvn spring-boot:run
然后在浏览器中运行http://localhost:8080/
它成功地打开了项目。我还搜索了其他页面也成功打开。
第一页如下所示http://localhost:8080/

所有审查页面如下所示:http://localhost:8080/api/reviews

[
  {"id":1,"userName":"ychennay","reviewText":"This restaurant was terrific!"},{"id":2,"userName":"david","reviewText":"This restaurant
 was okay!"},
  {"id":3,"userName":"ben","reviewText":"This restaurant was
 mediocre!"},
  {"id":4,"userName":"leon","reviewText":"This restaurant
 was awful!"},
  {"id":5,"userName":"lawrence","reviewText":"This
 restaurant was confusing!"}
]

因此,请替换您的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.diningapp</groupId>
  <artifactId>Dining</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <properties>
    <jackson.version>2.7.5</jackson.version>
    <spring-version>4.3.7.RELEASE</spring-version>
    <dynamodb-local.port>8000</dynamodb-local.port>
    <dynamodb-local.endpoint>http://localhost:${dynamodb-local.port}</dynamodb-local.endpoint>
    <spring-boot-version>1.5.2.RELEASE</spring-boot-version>
    <aws-sdk-java-version>1.11.124</aws-sdk-java-version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>    <!-- For UTF-8 support -->
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>    <!-- For UTF-8 support -->
  </properties>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.7</source>          <!-- Used java7 -->
          <target>1.7</target>          <!-- Used java7 -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot-version}</version>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>dynamodb-local-oregon</id>
      <name>DynamoDB Local Release Repository</name>
      <url>https://s3-us-west-2.amazonaws.com/dynamodb-local/release</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-releasetrain</artifactId>
      <version>Hopper-SR10</version>
      <type>pom</type>
      <!-- <scope>import</scope> -->
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <version>${spring-boot-version}</version>      <!-- You have missed to add this version -->
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <version>${spring-boot-version}</version>      <!-- You have missed to add this version -->
      <optional>true</optional>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-dynamodb</artifactId>
      <version>${aws-sdk-java-version}</version>
    </dependency>
    <dependency>
      <groupId>com.github.derjust</groupId>
      <artifactId>spring-data-dynamodb</artifactId>
      <version>4.3.1</version>
    </dependency>

    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-bom</artifactId>
      <version>${aws-sdk-java-version}</version>
      <type>pom</type>
      <!-- <scope>import</scope> -->
      <scope>provided</scope>      <!-- changed import to provided -->
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.38</version>      <!-- You have missed to add this version -->
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
      <version>${spring-boot-version}</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.10</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

错误和解决方案:

问题#1:

[WARNING] 'dependencies.dependency.scope' for org.springframework.data:spring-data-releasetrain:pom must be one of [provided, compile, runtime, test, system] but is 'import'. @ line 70, column 18

解决方案1:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-releasetrain</artifactId>
  <version>Hopper-SR10</version>
  <type>pom</type>
  <!-- <scope>import</scope> -->
  <scope>provided</scope>  <!-- changed import to provided -->
</dependency>

问题#2:

[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-devtools:jar is missing. @ line 73, column 19

解决方案2:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <version>${spring-boot-version}</version> <!-- You have missed to add this version -->
  <optional>true</optional>
</dependency>

问题#3:

[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-configuration-processor:jar is missing. @ line 78, column 19

解决方案3:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-configuration-processor</artifactId>
  <version>${spring-boot-version}</version> <!-- You have missed to add this version -->
  <optional>true</optional>
</dependency>

问题4:

[WARNING] 'dependencies.dependency.scope' for com.amazonaws:aws-java-sdk-bom:pom must be one of [provided, compile, runtime, test, system] but is 'import'. @ line 105, column 18

解决方案4:

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk-bom</artifactId>
  <version>${aws-sdk-java-version}</version>
  <type>pom</type>
  <!-- <scope>import</scope> -->
  <scope>provided</scope> <!-- changed import to provided -->
</dependency>

问题#5:

[ERROR] 'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ line 148, column 19

解决方案5:

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.38</version> <!-- You have missed to add this version -->
</dependency>
iq3niunx

iq3niunx2#

使用@Configuration代替@EnableAutoConfiguration,如下所示。此外,您还需要修复aws区域属性,因为属性文件和代码之间的名称不同- [amazon.dynamodb.region vs amazon.aws.region] -在以下更改后,一旦它开始拾取属性文件,就会引发错误。

@Configuration
@PropertySource("database.properties")
public class DynamoClientMapper {

    @Value("${amazon.dynamodb.endpoint}")
    private String amazonDynamoDBEndpoint;

    @Value("${amazon.aws.accesskey}")
    private String amazonAWSAccessKey;

    @Value("${amazon.aws.secretkey}")
    private String amazonAWSSecretKey;

    @Value("${amazon.aws.region}")
    private String amazonAWSRegion;
o3imoua4

o3imoua43#

请仔细检查您的maven-pom是否使用此 Package :

<packaging>war</packaging>

如果将其设置为pom或类似值,您的IDE可能无法识别模块的“Spring”特性(我在IntelliJ 2018中遇到过这种情况)。

pinkon5k

pinkon5k4#

是否尝试过以下方法?

@Component
@PropertySource("database.properties")
public class DynamoClientMapper { ...}

@Service
 @PropertySource("database.properties")
 public class DynamoClientMapper { ...}
b1zrtrql

b1zrtrql5#

您也可以使用固定路径。

  • @PropertySource(“文件:${C:/开发/工作区/项目/资源/}/application.properties“)*

在您想要使用不同属性文件的开发过程中非常有用。

u0njafvf

u0njafvf6#

一个问题也可能是你有spring-data-jpa的依赖关系在依赖关系的层次结构中重复,所以这样你就有了2组不同的环境配置文件,当运行应用程序时,运行者正在使用一组不需要的环境。

api("org.springframework.data", "spring-data-jpa", "2.3.4.RELEASE")

所以我建议检查项目模块,如果在一个层次结构中有多个依赖项下载的定义。虽然没有必要删除重新出现或重复的定义,但有必要注解和取消注解它们以重新同步,并使spring runner获得所需的环境集。
1.注解相依性
1.同步行程
1.取消注解依赖项
1.同步行程
1.运行应用程序

  • 等级的东西 *

GL语言

zte4gxcn

zte4gxcn7#

我遇到了类似的问题,我通过将我的appliation.properties文件添加到pom.xml中来解决它,如下所示:https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <targetPath>${project.build.outputDirectory}</targetPath>
            <includes>
                <include>application.properties</include>
            </includes>
        </resource>
    </resources>
ddrv8njm

ddrv8njm8#

我将告诉你什么对我有效。我在SpringBoot依赖项之前加载JPA依赖项,只是将其转换过来,瞧。尝试禁用/更改pom.xml中依赖项的顺序。

xoefb8l8

xoefb8l89#

对于从Sping Boot 1.x到2.x的(非常晚的)升级:
使用包含除resources/application.properties之外的www.example.com的其他目录位置application.properties

--spring.config.additional-location=.../

而不是 Boot ,后者在文件名方面更灵活,可以同时读取资源/application.properties和spring.config.location:

--spring.config.location=file:/...\myapplication.properties

Sping Boot 2.x仍然可以识别spring.config.位置,但不再是附加的,请参见https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#configuration-location和https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html

相关问题