今天我已经安装了IntelliJ Ultimate版本2016.1.1 build 145.597。我后来做的是从IntelliJ Community Edition导入可能项目。该项目基于spring-boot 1.3.3。问题是,当我想在IntelliJ Ultimate中运行我的应用程序时,某种程度上忽略了application.properties文件,它以默认弹簧设置开始。当我在IntelliJ Community Edition或命令行中运行相同的项目时,一切正常。如果我使用gradle配置和bootRun任务,则在添加并运行弹簧引导运行配置时,问题仅存在于Ultimate版本中。IntelliJ Ultimate忽略弹簧启动application.properties
我在IntelliJ Ultimate之前没有使用。 有谁知道什么可能是错的?我浪费了2个小时来解决我的问题,但我没有找到任何东西。
的的src/main /资源量/ application.properties中:
server.port=2081
server.ssl.key-store=cfg/certs/keystore.p12
server.ssl.key-store-password=dev
server.ssl.key-alias=alias
server.ssl.key-store-type=PKCS12
spring.datasource.url=jdbc:h2:file:./cfg/db/app;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=none
项目结构:
此时application.yml的内容是无关紧要的。更有趣的是你的项目的文件夹结构。即如果路径实际上是src/resources/application.properties,那么它不是默认的Maven结构,您必须确保您已在pom.xml中正确配置它。 – dunni
“src/resources”是你的资源目录还是“src/main/resources”(默认标准)?此外,IntelliJ是否将该目录识别为资源目录? – cjstehno
我已经包含了项目结构图。 @cjstehno它是默认的(src/main/resources/application.properties) – kojas