当前位置:网站首页>Teach you how to create SSM project structure in idea
Teach you how to create SSM project structure in idea
2022-06-12 13:18:00 【JanYork_ Little Jane】
Maven
SSM The project needs to use Maven To manage dependency , So we need to configure Maven,Maven It's easy to configure , I'm not going to show you .
Create structure
First , We build new Maven project , Check archetype, choice archetype-webapp Templates , Then create .
Here, wait patiently for the download to complete .
At this point, many white people may wonder why they created it web Project does not java Folder .
You can see , It's no use here Java Related folders .
We are directly in the main Right click the folder to create a new folder , A... Will be displayed below java, Just create it directly .
Create a hierarchy
here , We follow the rules , Create a package .
The project structure varies , For example, three-tier architecture , According to your needs .
I'll just show you a little .
Here, these structures can be named according to the specifications , There are many structures , There are also many layered approaches , Here we have the right to draw lessons from .
Configuration dependency
<dependencies>
<!--dependency>
<groupId>org.example</groupId>
<artifactId>[the artifact id of the block to be mounted]</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency-->
<!--mybatis-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.9</version>
</dependency>
<!--mybatis-spring-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.7</version>
</dependency>
<!-- database -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<!-- Database connection pool -->
<!--druid-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.18</version>
</dependency>
<!-- c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<!-- spring-mvc frame -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<!--spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<!--spring Integrate jdbc-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<!--spring Business management -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<!-- unit testing , coordination spring-test Can be used together spring test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!--servlet-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!--jsp-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
</dependency>
<!--jstl-api-->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--jstl Implementation package -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Jackson springMVC default Json The solution choice is Jackson, So just import jackson Of jar, You can use .-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
<!-- FastJson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.54</version>
</dependency>
<!-- File upload Kit -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- lombok plug-in unit -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</dependency>
<!-- pagehelper Paging plug-ins -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<!-- Kaptcha, Captcha generation tool -->
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependencies>I have integrated a dependency here , If you need to use, you can modify or add the version according to your own needs .
We've set it up Maven After dependence , Synchronize dependencies .
It looks like , Just don't report an error .
log4j
We also need to configure the log xml, Logs are still very important in our development process .
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn">
<appenders>
<console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</console>
<file name="log" fileName="log/test.log">
<patternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%1] %-5level-%msg%n"/>
</file>
<RollingFile name="RollingFileInfo" fileName="${sys:user.home}/logs/hpaasvc/info.log"
filePattern="${sys:user.home}/logs/hpaasvc/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="INFO"/>
<ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
<RollingFile name="RollingFileWarn" fileName="${sys:user.home}/logs/hpaasvc/warn.log"
filePattern="${sys:user.home}/logs/hpaasvc/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="WARN"/>
<ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
<RollingFile name="RollingFileError" fileName="${sys:user.home}/logs/hpaasvc/error.log"
filePattern="${sys:user.home}/logs/hpaasvc/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="ERROR"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
</appenders>
<loggers>
<!-- To filter out spring and hibernate Some of them are useless debug Information -->
<logger name="org.springframework" level="INFO">
</logger>
<logger name="org.hibernate" level="INFO">
</logger>
<root level="all">
<appender-ref ref="Console"/>
<appender-ref ref="RollingFileInfo"/>
<appender-ref ref="RollingFileWarn"/>
<appender-ref ref="RollingFileError"/>
</root>
</loggers>
</configuration> Of course , You can also use properties File to configure .
# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=INFO, CONSOLE debug info warn error fatal
log4j.rootCategory=info, CONSOLE, LOGFILE
# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=d:\axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\nOther dependence
In addition to these configurations , We have many others xml, It also needs to be configured , I'll provide one directly here xml Package , It can be modified to use .
If you want, you can add me , Send it directly to you ,747945307.
Once these configurations are in place , Basically, the structure comes out .
Epilogue
This article is a bit rough , You need to think about it yourself , The second time I became proficient . Here you just create the structure , You need to learn to use it slowly !
边栏推荐
- 442个作者100页论文!谷歌耗时2年发布大模型新基准BIG-Bench | 开源
- 成功跳槽阿里,进阶学习
- 多源BFS问题 模板(附题)
- 嵌入式系统概述3-嵌入式系统的开发流程和学习基础、方法
- torch_geometric message passing network
- Newoj week 10 question solution
- Jacobian matrix IK of manipulator
- [cloud native | kubernetes] kubernetes networkpolicy
- JVM 运行时参数
- Hardware composition of embedded system - introduction of embedded development board based on ARM
猜你喜欢

ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter

It is enough to read this article. Web Chinese development
![Will the next star of PPT for workplace speech be you [perfect summary] at the moment](/img/11/ac67db2641f42ef3d09417b790feb8.png)
Will the next star of PPT for workplace speech be you [perfect summary] at the moment

用PyTorch进行语义分割

403 you don't have permission to access this resource

Chrome debugging tool
![[Title brushing] Super washing machine](/img/f9/0c69afafa8b32afc5df5e91d6af172.png)
[Title brushing] Super washing machine
![[EDA] chip layout design: VLSI layout design using electric](/img/a1/da0739070c940b36bc7a55d8eb2fe5.jpg)
[EDA] chip layout design: VLSI layout design using electric

Pytorch官方Faster R-CNN源代码解析(一)——特征提取

LeetCode滑动窗口刷题总结
随机推荐
Software construction 03 regular expression
多源BFS问题 模板(附题)
ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter
C#DBHelper_ FactoryDB_ GetConn
Further understanding of the network
Itk:: neighborhood get 6 neighborhood, 18 neighborhood, 26 neighborhood, 18/6 neighborhood, 26/18 neighborhood
下一个职场演讲PPT的明星,会不会是此刻的你【完美总结】
Hudi key generation
Install MySQL database independently on Debian 10
Chaotic engineering practice of distributed kV storage in station B
It is enough to read this article. Web Chinese development
Improve pipeline efficiency: you need to know how to identify the main obstacles in ci/cd pipeline
itk itk::BSplineDeformableTransform
嵌入式系统概述1-嵌入式系统定义、特点和发展历程
R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting bar plot, adding significance level and jitter points
Share PDF HD version, series
单向环形链表实现约瑟夫环
[cloud native | kubernetes] kubernetes networkpolicy
嵌入式系统概述3-嵌入式系统的开发流程和学习基础、方法
2022 ARTS|Week 23