惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cisco Blogs
Scott Helme
Scott Helme
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
I
Intezer
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
V2EX - 技术
V2EX - 技术
Google Online Security Blog
Google Online Security Blog
L
Lohrmann on Cybersecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LINUX DO - 热门话题
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Security Archives - TechRepublic
Security Archives - TechRepublic
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
K
Kaspersky official blog
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
Latest news
Latest news
B
Blog
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
L
LangChain Blog
GbyAI
GbyAI
Last Week in AI
Last Week in AI
S
Security Affairs
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
Security Latest
Security Latest
Vercel News
Vercel News
Y
Y Combinator Blog
G
GRAHAM CLULEY
S
Securelist
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
雷峰网
雷峰网

博客园 - lizhigang

DBeaver 打开 utf8的sql文件 SMT 贴片机与 MES 系统集成指南 容器访问外部服务(10.100.1.90:9090)防火墙规则配置总结 Docker 容器间通信故障排查与修复操作总结 Docker 容器部署与运维总结报告 Nginx Docker 容器白名单配置操作总结 使用 pnpm 构建 Vue2 项目操作总结(Node 16 → Node 22) 前端项目 Docker 镜像构建完整操作总结 Windows 11 下使用 MySQL Workbench 还原多数据库备份文件操作指南 在 WSL2 + Docker Desktop 环境下构建前后端 Docker 镜像 从内网私有仓库迁移镜像到阿里云 ACR 完整指南 wsl网络设置允许访问ssh(端口22) 在 Windows 11 上安装 Docker Nginx配置 访问数据库报错 Windows系统运行RuoYi-Vue完整指南 RuoYi-Vue 项目结构分析 win11 报错 windows 11 如何使用 Microsoft Hyper-V VMware 替代产品 imes开发部署(IDEA社区版 差异) IntelliJ IDEA 社区版默认支持 Spring Boot 吗? imes开发部署 IDEA 端口被占用 解决办法 使用MySQL Workbench进行数据库备份 ruoyi-nbcio ktg-mes、ktm-mes-ui部署 Widows下安装和配置Redis Windows下Redis安装与配置全攻略 mes开源 imes:注意 若依框架:开源
IntelliJ IDEA 社区版支持 Spring Boot 开发说明文档
lizhigang · 2025-11-03 · via 博客园 - lizhigang

当然可以,以下是根据我们之前的完整对话整理而成的 说明文档,适用于开发者、技术团队或个人学习使用。


IntelliJ IDEA 社区版支持 Spring Boot 开发说明文档

版本:v1.0
适用对象:Java 开发者、Spring Boot 初学者、使用 IntelliJ IDEA 社区版的用户
最后更新:2025年11月3日


一、核心结论

IntelliJ IDEA 社区版(Community Edition)支持 Spring Boot 项目的开发与运行,但部分高级功能(如可视化模板、Spring Initializr 集成)仅在 Ultimate 版中提供。

关键点

  • 社区版 可以正常创建、运行、调试 Spring Boot 项目
  • 可通过 VM options 设置 spring.profiles.active 激活不同环境配置(如 application-test.yml
  • 虽无“Spring Boot”运行模板或“有效配置文件”字段,但功能不受影响

二、常见误解澄清

误解澄清
“社区版不支持 Spring Boot” ❌ 错误。只要项目结构正确,可完全运行 Spring Boot 应用
“没有 Spring 模板 = 不支持” ❌ 错误。模板缺失是功能限制,不影响实际运行
“不能设置 test 环境” ❌ 错误。可通过 -Dspring.profiles.active=test 实现

三、社区版对 Spring Boot 的支持能力

功能是否支持说明
✅ 运行 Spring Boot 应用 ✅ 支持 右键主类即可运行
✅ 识别 @SpringBootApplication ✅ 支持 能正确识别启动类
✅ 加载 application.yml ✅ 支持 自动读取配置文件
✅ 激活 Profile(如 test) ✅ 支持 使用 -Dspring.profiles.active=test
⚠️ “Spring Boot”运行模板 ❌ 不显示 社区版无此可视化功能
⚠️ “有效配置文件”字段 ❌ 不显示 仅 Ultimate 版提供
⚠️ 新建项目时的 Spring 模板 ❌ 灰色不可用 社区版无 Spring Initializr 集成

💡 结论功能可用,界面简化。开发者需手动配置,但不影响开发效率。


四、在社区版中运行 Spring Boot 的正确方式

方法一:通过 Maven 创建项目(推荐)

  1. 打开 IDEA 欢迎界面 → New Project
  2. 选择 Maven → 勾选 “Create from archetype”
  3. 搜索并选择:org.springframework.boot:spring-boot-starter-parent
  4. 填写 GroupIdArtifactIdVersion
  5. 点击 Finish,等待依赖下载

✅ 自动生成 pom.xml,IDEA 自动识别为 Spring Boot 项目


方法二:将现有项目转为 Spring Boot 项目

  1. 右键项目根目录 → 添加框架支持...(Add Framework Support)
  2. 勾选 SpringSpring Boot
  3. 点击 确定
  4. IDEA 会自动生成 pom.xml 并引入依赖

⚠️ 若失败,建议手动创建 pom.xml


方法三:手动配置运行环境(无需模板)

即使没有“Spring Boot”模板,也可通过“应用程序”手动配置:

配置项
主类 com.ktg.RuoYiApplication(根据实际修改)
模块 选择你的模块(如 ktg-admin
VM options -Dspring.profiles.active=test
Program arguments (可选)--spring.profiles.active=test
Environment variables SPRING_PROFILES_ACTIVE=test

✅ 三者任选其一即可激活 application-test.yml


五、验证是否成功

1. 查看控制台日志

启动后应看到:

The following profiles are active: test

2. 检查配置文件加载

  • 确保 src/main/resources/application-test.yml 存在
  • 检查其中的配置(如端口、数据库)是否生效

3. 手动打印当前 Profile

@Autowired
private Environment environment;

@PostConstruct
public void printProfiles() {
    System.out.println("Active profiles: " + 
        Arrays.toString(environment.getActiveProfiles()));
}

六、常见问题与解决方案

问题原因解决方案
找不到“添加框架支持” 右键了项目根目录,而非模块 右键模块目录(如 ktg-admin
“Spring”模板灰色 社区版限制 使用 Maven 手动创建项目
无法识别 Spring 注解 未添加框架支持 手动添加或检查 pom.xml
未加载 application-test.yml 未设置 spring.profiles.active 在 VM options 中添加 -Dspring.profiles.active=test

七、最佳实践建议

  1. 优先使用 Maven 构建项目,确保依赖管理清晰
  2. 统一使用 VM options 设置 Profile,避免混淆
  3. 命名规范
    • application.yml:主配置
    • application-dev.yml:开发环境
    • application-test.yml:测试环境
    • application-prod.yml:生产环境
  4. 多环境运行配置:可创建多个运行配置,分别设置不同 Profile

八、总结

IntelliJ IDEA 社区版完全可以胜任 Spring Boot 日常开发任务

虽然缺少 Ultimate 版的可视化辅助功能,但通过以下方式即可实现完整开发体验:

  • ✅ 使用 Maven 管理项目
  • ✅ 手动配置运行参数
  • ✅ 正确设置 spring.profiles.active

对于个人开发者、学习者或中小型项目,社区版是完全足够且推荐的选择


附录:标准 pom.xml 示例

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ktg</groupId>
    <artifactId>ruoyi</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

文档结束
如有疑问,可参考 IntelliJ IDEA 官方文档 或 Spring Boot 官方指南。