maven常用Java配置
Posted 每周向前一小步
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven常用Java配置相关的知识,希望对你有一定的参考价值。
spring mvc
pom.xml
<!--日志--> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.21</version> </dependency> <!--J2EE--> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!--mysql驱动包--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <!--springframework--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.2.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.2.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.2.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.2.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.2.6.RELEASE</version> </dependency> <dependency> <groupId>com.github.stefanbirkner</groupId> <artifactId>system-rules</artifactId> <version>1.16.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.8.9</version> </dependency> <!--其他需要的包--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency>
要先添加spring相关jar引用,然后 才可以 项目右键 -->add framework support --> spring mvc
log4j2
日志位置
log4j2只支持xml和json两种格式的配置,所以配置log4j.properties是没有作用的。
log4j的2.x版本在默认情况下,系统选择configuration文件的优先级如下
1.classpath下名为log4j-test.json或者log4j-test.jsn文件
2.classpath下名为log4j2-test.xml
3.classpath下名为log4j.json或者log4j.jsn文件
4.classpath下名为log4j2.xml
以上是关于maven常用Java配置的主要内容,如果未能解决你的问题,请参考以下文章