idea搭建springboot项目(一)

第一步:先创建父工程

1、Create New Project 或File>New>Project...

2、选择Spring Initializr,然后点击Next

3、输入Group与Artifact,其中GroupId为域.公司名,Artifact为项目名 ,Java Version选 8 ,然后点击Next

4、父工程的Dependencies暂时不需要选择,根据后续实际情况引入即可,所以在这里直接点击Next进入到下一步。

5、填写项目名以及保存的项目路径,然后点击Finish

6、新建完成父工程之后将多余的文件和文件夹删除

7、配置pom文件,添加或将packaging更改为pom

<packaging>pom</packaging>

第二步:先创建子工程

1、选中父模块,点击鼠标右键,然后点击New—>Module

2、选择Spring Initializr,然后点击Next

3、输入Group与Artifact,其中GroupId为域.公司名,Artifact为项目名 ,Java Version选 8 ,然后点击Next

4、点击Next进入到下一步

5、填写项目名,然后点击Finish

6、新建完成子工程

7、父模块的pom.xml,在其中modules下加入刚才创建的子模块

<modules>
<module>crawler-autohome</module>
</modules>

8、子模块的pom.xml文件,将其中parent更改为对应父模块的信息

<parent>
<!--<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.2.RELEASE</version>
<relativePath/>--> <!-- lookup parent from repository -->
<groupId>cn.zj</groupId>
<artifactId>crawler</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

报错NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget

解决办法:
在pom.xml中加入

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>4.3.12.RELEASE</version>
</dependency>

猜你喜欢

转载自www.cnblogs.com/zj68/p/13401580.html