1. 因为社区办不支持使用spring Spring Initializr 的方式创建项目, 但是我们可以考虑使用别的方式达到效果:

创建方式有3种:

第一种:使用https://start.spring.io/ 官方URL创建项目,再导入到 IDEA Community Edition(后面简称:ideaC)。具体使用自行百度。缺点:没办法自定义springboot的版本。

第二种:下载插件:Spring boot Assistant, 然后就可以按照商业版的方式创建。

第三种:也是我今天推荐使用的方式。用ideaC的方式来创建:

1. 创建父工程:

2. 右键父项目,新建第一个子模块idea-service:

3. 同样的方式再创建一个子项目idea-stub:

4. 修改父工程的pom文件,添加springboot-parent 依赖 及其你想添加的依赖:

<?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>
<packaging>pom</packaging> <modules>
<module>idea-service</module>
<module>idea-stub</module>
</modules> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<relativePath/>
</parent> <groupId>org.example</groupId>
<artifactId>demo-IdeaC</artifactId>
<version>1.0-SNAPSHOT</version> <properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

5. 查看idea-stub的依赖有没问题,因为我设计stub项目是为了暴露服务的,暂时不需要添加其他jar包:

<?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>
<parent>
<groupId>org.example</groupId>
<artifactId>demo-IdeaC</artifactId>
<version>1.0-SNAPSHOT</version>
</parent> <artifactId>idea-stub</artifactId> <properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </project>

6. 查看idea-service的依赖,主要是spring-web的jar包,这是主服务端,需要负责项目启动,还要添加IdeaDemoApplication 启动类:

<?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>
<parent>
<groupId>org.example</groupId>
<artifactId>demo-IdeaC</artifactId>
<version>1.0-SNAPSHOT</version>
</parent> <artifactId>idea-service</artifactId> <properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<!-- spring-boot启动相关依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.2.2</version>
</dependency>
</dependencies> </project>
 6.1  还需要修改2个子项目的打包方式为jar,父工程确认为pom:
 
6.2: 添加IdeaDemoApplication 启动类,要修改ComponentScan()扫描的地方:

package org.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync; @EnableAsync
@Configuration
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan({"org.example.*"})
public class IdeaDemoApplication { public static void main(String[] args) {
SpringApplication.run(IdeaDemoApplication.class, args);
} }

7.  如果不需要加载数据源的话,配置启动应用程序:

8. 结果:

9. 如果需要配置数据源的话,需要添加yml文件,@SpringBootApplication(exclude =)要取消排除数据源:

IDEA社区版(IDEA Community Edition)创建Springboot父子项目的更多相关文章

  1. Eclipse创建Maven父子项目

    Eclipse创建Maven父子项目 - 木头若愚 - CSDN博客https://blog.csdn.net/jay_1989/article/details/53906995 创建maven项目是 ...

  2. 创建Maven父子项目以及它们的优点

    此文引用:https://blog.csdn.net/zxl8876/article/details/104180133 创建maven父子项目 第一步创建父项目: 新建一个普通的maven项目 删除 ...

  3. 社区版Intelij IDEA快速创建一个spring boot项目(找不到sping Initializer选项)

    首先作为一个初学spring boot的小白,在学习过程中肯定会遇到各种问题... So,问题出现:在我想快速创建spring boot项目时,却在新建列表中找不到sping Initializer这 ...

  4. 第三篇 -- IDEA 创建Springboot Web项目并用Jmeter测试

    上一节使用Django写的一个接口程序,这一节讲用IDEA配合Springboot创建web项目.一个是python,一个是java. 参考链接:http://www.uxys.com/html/Ja ...

  5. 二创建maven父子项目

    关于maven中的parent聚合一直都有没好好总结,固有这篇. ------------------------------------------------------------------- ...

  6. 创建maven父子项目(九)

    一.父子-聚合项目 通过 maven 可以创建父子-聚合项目. 所谓的父子项目,即有一个父项目,有多个子项目.这些子项目,在业务逻辑上,都归纳在这个父项目下,并且一般来说,都会有重复的jar包共享.所 ...

  7. IDEA创建SpringBoot+maven项目

    1.创建项目: 2.选择spring Initializr,注意要选择jdk,使用默认的spring.io这样就不用再去写pom文件了 3.输入项目名称: 4.选择Spring Web 5.目录结构:

  8. intellij idea社区版 & maven & git & tomcat/jetty 的struts2项目的搭建

    1.新建一个project,并在project下新建一个maven module.

  9. idea创建springboot Web项目

    一.File —— New —— Project 二.next 三.选择你要的骨架,然后 next.个人觉的这些不用选,因为就是帮你建了几个文件夹,导入了几个jar包依赖而已. 四.Finish 五. ...

  10. Spring Boot2 系列教程(二)创建 Spring Boot 项目的三种方式

    我最早是 2016 年底开始写 Spring Boot 相关的博客,当时使用的版本还是 1.4.x ,文章发表在 CSDN 上,阅读量最大的一篇有 43W+,如下图: 2017 年由于种种原因,就没有 ...

随机推荐

  1. 深入了解 Spring Boot 核心特性、注解和 Bean 作用域

    Spring Boot 是什么? Spring Boot 是基于 Spring Framework 构建应用程序的框架,Spring Framework 是一个广泛使用的用于构建基于 Java 的企业 ...

  2. 【FAQ】用户访问次数不变,访问时长却突增2倍,分析服务发生数据异常该如何解决?

    在产品运营的工作过程中,需要每日关注产品的核心指标变化情况,监控其整体运营状况.华为分析服务提供查看吸引新用户卡片,该卡片展示了新增用户数.人均会话次数.人均访问时长.人均页面访问数.借助该页面运营可 ...

  3. Excel分析师的工资能一直飙升,原因其实是...

    世界上的数据分析师分为使用Excel的分析师和其他分析师两类. 即使在互联网数据分析界,java遍街头,Python不如狗,Excel也是不可替代的. 上班前以为自己是西装笔挺的Excel数据分析师, ...

  4. Linux之openssl实现私有CA

    一.简介 Centos7.9通过openssl工具构建一个私有的CA,用于颁发证书. 验证私有CA为httpd应用签署证书 二.构建私有CA 1.编辑CA的配置文件 [root@HLWHOST tls ...

  5. Spring Cloud Alibaba 官方实践指南【文章有点长自备咖啡茶点】

    注:本文内容均转自官方文档,方便胖友们学习,不代表博主观点. 链接地址:SpringCloudAlibaba | Spring Cloud Alibaba 基于网关实现 SpringCloud 服务发 ...

  6. 抓包整理————wireshark 抓包[二]

    前言 简单整理一些wireshark抓包. 正文 打开wireshark 的capture的option 选项: 然后可以看到可以捕获的选项: 可以看到这里有我的以太网和虚拟机网卡流量. 这个就是将l ...

  7. Sarsa模型和Q_learning模型简记

    1. Sarsa模型 1.1 Sarsa类代码: class SarsaAgent(object): def __init__(self,state_n,action_n,learning_rate= ...

  8. chrome浏览器代理插件SwitchyOmega使用

    第一步:下载SwitchyOmega插件 Proxy_SwitchyOmega_2.5.21.crx 第二步:安装插件, 1,在chrome扩展程序开启开发者模式: 2,将插件拖过来: 第三步:设置代 ...

  9. KubeOperator技术方案

    KubeOperator技术方案 总体介绍︎ KubeOperator 是一个开源的轻量级 Kubernetes 发行版,专注于帮助企业规划.部署和运营生产级别的 Kubernetes 集群. Kub ...

  10. 痞子衡嵌入式:在i.MXRT1xxx系列上用NAND型启动设备时可用两级设计缩短启动时间

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家分享的是在i.MXRT1xxx系列上用NAND型启动设备时可用两级设计缩短启动时间. 去年痞子衡写过一篇骚操作文章 <借助i.MXRT10 ...