When using IDEA for Spring Boot project development, if you encounter the problem of not being able to read after compilation@@
The problem is usually caused by several reasons:
Resource filtering is not enabled: existIn this case, you need to ensure that resource filtering is enabled, so that Maven will be replaced during construction.
@@
is the actual profile value. Can be<build>
Add the following configuration in the tag:
<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build>
After this configuration, you need to re-execute Maven'sclean
andinstall
command, or execute "Reload All Maven Projects" in IDEA to make the configuration take effect.
Profile configuration: make sureThe corresponding profile has been defined in
<activeByDefault>
Mark as the default activated profile. For example:
<profiles> <profile> <id>dev</id> <properties> <>dev</> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <!-- otherprofiles --> </profiles>
After this configuration, Maven will be replaced according to the activated profile@@
is the corresponding profile value.
Project Settings: In IDEA, make sure you have set the Run/Debug Configuration correctly, including the correct profile parameters. For example, you can add in the run configuration--=dev
Parameters to specify the activated profile.
4. Check the configuration file: make sureor
Used in
@@
placeholder, and the file is located insrc/main/resources
In the directory.
5. Clean and re-import the project: Sometimes, IDEA's cache may cause incorrect configuration reads. You can try to clean the cache and restart IDEA, or reimport the Maven project.
6. Check Spring Boot startup class: Make sure there is no hard-coded profile settings on Spring Boot's startup class, which may override external configurations.
Through the above steps, it is usually possible to solve the problem that IDEA cannot be read after compilation@@
The problem. If the problem persists, you can check the IDEA's log output to find out if there is any error information about the failed profile activation, and further troubleshoot the problem based on the error message.
This is the end of this article about the problem that the Spring Boot cannot read @@ after the development and compilation. For more related Spring Boot, if you cannot read @@, please search for my previous articles or continue browsing the related articles below, I hope you will support me in the future!