我已经使用初始化程序使用2.1.3.BUILD-SNAPSHOT构建了一个Spring Boot应用程序。在Eclipse中运行时,获取JSON解析异常。
当我在命令行上使用--spring.application.json={\"foo\":\"bar\"}
参数时,它将起作用。如何使它工作而不必每次都键入?
4.0.0
org.springframework.boot
弹簧启动启动器父母
2.1.15发布
com.gktechtalks.blog
服务
0.0.1-快照
服务
GKTechTalks博客服务
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
`
这是一个全新的春季启动项目。从“ https://start.spring.io/”创建 我将项目导入eclipse并运行,然后出现异常。 我没有添加任何配置。
在异常以下
然后我提供了
--spring.application.json={\"foo\":\"bar\"}
然后启动应用程序,没有任何例外。这就是为什么我有一个问题,为什么我们不能在命令行中没有该属性而运行。