首先报No active profile set, falling back to default profiles: default是没有配置spring.profiles.active:
解决方案引入对应的文件,在application.yml中引入:
spring:
profiles:
active: dev
接下来在对应的目录中创建对应的不同环境的yml文件,如下图所示:
此时切换至开发环境,项目运行读取的是application-dev.yml配置,如果需要读取生产环境,将application.yml中的active:dev改成prod即可。如果需要添加更多环境配置。按此操作即可。
springboot启动失败不报错
显示情况如下所示文章来源:https://www.toymoban.com/news/detail-620703.html
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.4)
2022-12-13 10:18:52.858 INFO 14232 --- [ main] c.k.s.SpringbootDemoApplication : Starting SpringbootDemoApplication using Java 1.8.0_202 on 2F-KF03 with PID 14232 (D:\i-word\springboot-demo\target\classes started by Administrator in D:\i-word\springboot-demo)
2022-12-13 10:18:52.860 INFO 14232 --- [ main] c.k.s.SpringbootDemoApplication : No active profile set, falling back to 1 default profile: "default"
2022-12-13 10:18:53.143 INFO 14232 --- [ main] c.k.s.SpringbootDemoApplication : Started SpringbootDemoApplication in 0.496 seconds (JVM running for 0.992)
Process finished with exit code 0
这里是没有引入spring-boot-starter-web所导致,引入对应pom文件即可解决问题文章来源地址https://www.toymoban.com/news/detail-620703.html
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
到了这里,关于spring boot 启动失败,不报错,但是报这个No active profile set, falling back to default profiles: default的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!