gradle创建web工程
-
配置环境
-
添加插件
-
build.gradle中添加依赖
dependencies {
implementation 'org.springframework:spring-beans:4.1.7.RELEASE'
implementation 'org.springframework:spring-web:4.1.7.RELEASE'
implementation 'org.springframework:spring-webmvc:4.1.7.RELEASE'
implementation 'org.springframework:spring-tx:4.1.7.RELEASE'
implementation 'org.springframework:spring-test:4.0.5.RELEASE'
implementation 'org.springframework:spring-jdbc:4.1.7.RELEASE'
implementation 'org.mybatis:mybatis-spring:1.2.3'
implementation 'org.mybatis:mybatis:3.3.0'
implementation 'mysql:mysql-connector-java:5.1.36'
implementation 'com.alibaba:druid:1.0.15'
implementation "com.fasterxml.jackson.core:jackson-databind:2.2.3"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.2.3"
implementation "com.fasterxml.jackson.core:jackson-core:2.2.3"
implementation 'org.aspectj:aspectjweaver:1.8.6'
implementation 'log4j:log4j:1.2.17'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'jstl:jstl:1.2'
compileOnly 'javax.servlet:servlet-api:2.5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
-
main文件夹下新建webapp文件夹,再新建WEB-INF文件夹,再新建web.xml
-
resource路径下新建
applicationContext.xml
springmvc.xml
mybatis-config.xml
jdbc.properties
- 最后编写业务逻辑即可