Issue
Spring is not detecting my application.properties in the config folder. The config file: (Sensitive Information hidden)
server.port = 8090
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:URL}:3306/DB
spring.datasource.username=USER
spring.datasource.password=PW
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
debug=true
Folder structure:
Server.java
@SpringBootApplication
@EnableAutoConfiguration
public class Server {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(Server.class);
application.run();
}
}
I tried putting the properties in he top and resources folder, nothing seems to work. If I try to load it via VM options it says resource not found. The config folder is marked as resource folder in IntelliJ
Solution
The problem has been solved. The home directory for the run configuration needs to be set to the folder containing the resources folder. Which it wasn't before. Folder Structure now:
Answered By - Alex_X1
Answer Checked By - Timothy Miller (JavaFixing Admin)