No such application config! Please add dubbo:application

SpringBoot running configuration file can not be found application.properties


Project start running springBoot error: java.lang.IllegalStateException:! No such application config Please add to your spring config. The literal meaning is not found dubbo.application.name this property, Baidu under a lot of posts encounter this problem, but did not solve my problem in this record.


The first problem encountered is the possibility that the configuration file error , such as yml one less file space after the colon, or attribute spelling mistakes.

The second possibility is a resources directory does Mark AS resources root , leading to read configuration files in less than the corresponding directory (idea)

I have checked the configuration files and directories, this report is still wrong, only to find the answers code. In ConfigFileApplicationListener class, you can see DEFAULT_SEARCH_LOCATIONS loaded by default Location: "the CLASSPATH: /, the CLASSPATH: / config /, File: ./, File : ./ config /", DEFAULT_NAMES default configuration file name: "application"

In fact, the problem lies in here, but did not notice here, continue to look for the source to see the post, has said that rely on conflict, there are no facts say configured, even someone answers Springboot version of the problem, it is Ben collapse.
Finally, look to target directory compiled code, only to find not application.properties file, the original problem in here, suddenly, transformed into question: Why did not the configuration file compiled .

Carefully check the directory and found that the company's profile on the resources / spring below, he moved to the resources below, compiled successfully. Run successfully.


Find this issue gave me two inspired:

  • It reported a mistake, something that is not as it should be, for example, as it should feel no profile misplaced, should no longer exclude the issue carefully.
  • Learn to use Idea of ​​target viewing compiled code, never used before, now is simply convenient, idea really fragrant

Guess you like

Origin www.cnblogs.com/metabolism/p/11830774.html