After springboot is run from the main method, the profile configured in pom is invalid

in the springboot project in intellij idea, start the springboot project by running the main method of application.

but in maven"s pom.xml, profile, is configured to take these profile into account if it is running.

for example, I provided two profile, in pom, one for activemq, and one for kafka,. I want to load different message dependencies under different profile.

but if you start the main method directly in application, you will always report an error because when you are in one of the profile, the code in the code about the other kind of message will report an error because the dependency cannot be found.

the following code is the two profile. configured in pom

  https://pan.baidu.com/s/1fGd-.

you can go down, import it into idea, and test


main startup adds startup parameters

spring.profiles.active=

clipboard.png


are you using maven profile configuration?

ides/introduction/introduction-to-profiles.html" rel=" nofollow noreferrer "> maven official document

  refer to this  

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e44ec3-59b40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e44ec3-59b40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?