初识spring boot maven管理--配置文件

傷城~ 2022-08-26 14:16 301阅读 0赞

web环境下修改信息需要重启服务器,如果在一个大型的项目中经常重启服务器,那浪费的时间可想而知,今天介绍个好东西 —spring boot!一般学习都是从hello world开始学习的!下面介绍springboot 在maven配置和使用!

先进行pom.xml配置,


4.0.0
authentication
ammaven
war
0.0.1-SNAPSHOT
ammaven Maven Webapp
http://maven.apache.org

UTF-8
4.0.3.RELEASE
3.8.1
2.4


org.springframework.boot
spring-boot-starter-parent
1.0.1.RELEASE





org.springframework.boot
spring-boot-starter-web


commons-fileupload
commons-fileupload
1.3.1




commons-io
commons-io
${common-io}




junit
junit
${junitversion}
test


org.springframework
spring-aop
${springversion}
jar
compile


org.springframework
spring-aspects
${springversion}
jar
compile


org.springframework
spring-beans
${springversion}
jar
compile


org.springframework
spring-context
${springversion}
jar
compile


org.springframework
spring-context-support
${springversion}
jar
compile


org.springframework
spring-core
${springversion}
jar
compile


org.springframework
spring-expression
${springversion}
jar
compile


org.springframework
spring-jdbc
${springversion}
jar
compile


org.springframework
spring-jms
${springversion}
jar
compile


org.springframework
spring-orm
${springversion}
jar
compile


org.springframework
spring-oxm
${springversion}
jar
compile


org.springframework
spring-tx
${springversion}
jar
compile


org.springframework
spring-web
${springversion}
jar
compile


org.springframework
spring-webmvc
${springversion}
jar
compile


org.springframework
spring-test
${springversion}
jar
compile




javax.servlet
jstl
1.2
jar
compile




commons-collections
commons-collections
3.1




commons-logging
commons-logging
1.1





ammaven

下载完依赖的jar包下面开始配置spring和springMVC

首先配置和applicationContext.xml

<?xml version=”1.0” encoding=”UTF-8”?>












classpath:log4j.properties



再配置spring mvc:


<!— 配置异常处理

index
—>















最后需要配置web.xml

<?xml version=”1.0” encoding=”UTF-8”?>

MyMVC

index.jsp

contextConfigLocation

classpath:applicationContext.xml

log4jConfigLocation

classpath:log4j.properties

mvc

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:mvc.xml

true

1

mvc

*.mvc

org.springframework.web.util.Log4jConfigListener

org.springframework.web.context.ContextLoaderListener

发表评论

表情:
评论列表 (有 0 条评论,301人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Spring Boot框架

    前面的铺垫文章已经连着写了六篇了,主要是介绍了Spring和SpringMVC框架,小伙伴们在学习的过程中大概也发现了这两个框架需要我们手动配置的地方非常多,不过做JavaEE