Search code examples
javaspring-bootintellij-idea

Unused properties in application.properties file in Spring Boot


When I tried to connect Spring Boot to the MySQL database there was an issue called: Unused property in the application.properties file.

This is my application.properties file. application.properties file.

This is my pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
 
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.fund</groupId>
<artifactId>Slip_Manager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Slip_Manager</name>
<description>This is a Slip Manager product</description>
<properties>
    <java.version>17</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>com.mysql</groupId>
        <artifactId>mysql-connector-j</artifactId>
        <scope>runtime</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

I use IntelliJ IDEA 2022.3.1 (Community Edition).


Solution

  • IntelliJ IDEA Community doesn't come with support for Spring Boot features, including application.properties file syntax. You are getting this warning because IntelliJ IDEA Community thinks it's just a standard Java .properties file, which is not referenced in your source code.

    IntelliJ IDEA Ultimate, which is the paid version, has support for Spring Boot.