首页 > 其他分享 >No active profile set, falling back to default profiles: default

No active profile set, falling back to default profiles: default

时间:2022-12-23 15:13:03浏览次数:58  
标签:profile set default back profiles active falling

前言


最近在IDEA中导入一个 springboot 项目,导入后发现配置文件不起作用,按照网上教程,检查pom.xml文件中是否存在

<packaging>pom</packaging>

(若存在,将其删除,再重新编译)
试了这个方法,好像不对路
后来又试图新建application.yml

spring:
  profiles:
    active: dev

发现还是不起作用

正文


在日志中看到一句

No active profile set, falling back to default profiles: default

查找后发现,是IDEA没有将resources文件夹正确识别出来

解决方法:

  1. 右键点击项目文件夹->Open Modules Settings
  2. 在界面左侧侧Project Settings->Modules中点击项目
  3. 在界面右侧文件树找到对应的resources文件夹,点击上方Mark as: Resources
  4. 点击确认,退出,重新编译,发现运行正常了(正常的yml配置文件中,配置的server端口号数字会变成蓝色)

参考


[1]. {解决 :No active profile set, falling back to default profiles: default 问题}(https://blog.csdn.net/weixin_42140801/article/details/127267102)

标签:profile,set,default,back,profiles,active,falling
From: https://www.cnblogs.com/brian-sun/p/17000698.html

相关文章