上一篇jsf环境搭建的基础上 , 加入spring框架 , 先看下目录结构

spring-自动加载配置文件\使用属性文件注入

src/main/resources 这个source folder 放置web项目所需的主要配置,打包时,会自动打包到WEB-INF下

首先看下pom.xml,需要引入一些依赖项:

 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 3     <modelVersion>4.0.0</modelVersion>
 4     <groupId>yjmyzz</groupId>
 5     <artifactId>jsf-web</artifactId>
 6     <version>1.0</version>
 7     <packaging>war</packaging>
 8 
 9 
10     <dependencies>
11         <!-- 单元测试 -->
12         <dependency>
13             <groupId>junit</groupId>
14             <artifactId>junit</artifactId>
15             <version>4.7</version>
16             <scope>test</scope>
17         </dependency>
18 
19         <!-- jsf -->
20         <dependency>
21             <groupId>org.jboss.spec.javax.faces</groupId>
22             <artifactId>jboss-jsf-api_2.1_spec</artifactId>
23             <version>2.1.19.1.Final-redhat-1</version>
24             <scope>compile</scope>
25         </dependency>
26 
27 
28         <!-- spring -->
29         <dependency>
30             <groupId>org.springframework</groupId>
31             <artifactId>spring-context</artifactId>
32             <version>4.0.2.RELEASE</version>
33         </dependency>
34 
35 
36         <dependency>
37             <groupId>org.springframework</groupId>
38             <artifactId>spring-web</artifactId>
39             <version>4.0.2.RELEASE</version>
40         </dependency>
41 
42 
43         <!-- servlet支持 -->
44         <dependency>
45             <groupId>javax.servlet</groupId>
46             <artifactId>servlet-api</artifactId>
47             <version>2.5</version>
48         </dependency>
49 
50     </dependencies>
51 
52     <build>
53         <plugins>
54             <plugin>
55                 <artifactId>maven-compiler-plugin</artifactId>
56                 <version>3.1</version>
57                 <configuration>
58                     <source>1.7</source>
59                     <target>1.7</target>
60                 </configuration>
61             </plugin>
62             <plugin>
63                 <artifactId>maven-war-plugin</artifactId>
64                 <version>2.3</version>
65                 <configuration>
66                     <warSourceDirectory>webapp</warSourceDirectory>
67                     <failOnMissingWebXml>false</failOnMissingWebXml>
68                 </configuration>
69             </plugin>
70         </plugins>
71     </build>
72 </project>
pom.xml

相关文章:

  • 2022-12-23
  • 2021-07-27
  • 2021-11-20
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-11-27
相关资源
相似解决方案