5

Today I've install IntelliJ Ultimate version 2016.1.1 build 145.597. What I did later, was import of may project from IntelliJ Community Edition. This project is based on spring-boot 1.3.3. The problem is that when I want to run my application in IntelliJ Ultimate somehow application.properties file is ignored and it starts with default spring settings. When I'm running the same project in IntelliJ Community Edition or from command line everything works fine. Problem exists only in Ultimate edition when I'm adding and running spring boot run configuration, if I use gradle configuration and bootRun task it works.

I didn't use before IntelliJ Ultimate. Does anyone know what could be wrong? I wasted 2 hours googling for solution of my problem but I didn't find anything.

Content of src/main/resources/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

Project structure:
project structure

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
kojas
  • 51
  • 1
  • 1
  • 4
  • At this point the content of the application.yml is irrelevant. More interesting would be the folder structure of your project. I.e. if the path is really src/resources/application.properties, then it's not the default Maven structure and you have to make sure, that you have configured it correctly in your pom.xml. – dunni Apr 25 '16 at 18:25
  • 1
    Is "src/resources" your resource directory or is it "src/main/resources" (the default standard)? Also, does IntelliJ recognise that directory as a resources directory? – cjstehno Apr 25 '16 at 18:49
  • I've included project structure image. @cjstehno It's default (src/main/resources/application.properties) – kojas Apr 25 '16 at 19:47
  • Have you deleted the .idea and the .iml folder / file before importing? Also, shouldn't your package be under src/main/java? Currently I can see the package kotlin under src/main? – Marco Tedone Apr 25 '16 at 21:31
  • @MarcoTedone I am using Kotlin in my project so src/main/kotlin is fine. I didn't delete .iml folder. I created new project in IntelliJ Ultimate and simple copy paste necessary files from project that doesn't work. Right now it seems to work fine. Thanks for all help. – kojas Apr 26 '16 at 07:13

4 Answers4

4

I had same issue for IntelliJ Ultimate 2016.1.1

Reimporting the project and deleting existing project worked for me.

I believe the issue is pertinent with 1.1 version. Didn't had issue with IntelliJ IDEA 2016.1.4

  • This fixed it for me in 2018.3.5 as well. I think this happened because of an unclean startup (power outage). Quite tired with Intellij... – Lakatos Gyula Mar 25 '19 at 16:06
1

check if file application.properties is directly under target/classess after compiled, maybe the wrong settings copy it to other directory that spring boot cannot know

Luke Cheung
  • 479
  • 6
  • 8
0

one simple thing to fix the problem.

  1. If you already open the IntelliJ idea, close the project and remove it from IntelliJ idea.
  2. navigate to your project directory (ex: F:\dev\my-project) and remove the .idea folder from it.
  3. then open the IntelliJ idea again. open your project from File -> Open.
  4. then run the project.

this is the simplest solution. thanks!

0

I had a similar problem with my spring boot application running from IntelliJ Ultimate Version 2020.3 . I had a Connection.properties configured in spring-config.xml file as below and got the FileNotFoundException for my Connection.properties file even after placing the file under src/main/resources folder in my gradle project

<context:property-placeholder location="file:Connection.properties" />

It worked after changing it to

<context:property-placeholder location="classpath:Connection.properties" />

Note the "file:" to "classpath:" in "location" attribute

akarahman
  • 235
  • 2
  • 15