File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <groupId >com.monkey01</groupId >
6+ <artifactId >tomcat-apr-sample</artifactId >
7+ <version >0.0.1-SNAPSHOT</version >
8+ <packaging >jar</packaging >
9+
10+ <!-- 引入spring boot的依赖 -->
11+ <parent >
12+ <groupId >org.springframework.boot</groupId >
13+ <artifactId >spring-boot-starter-parent</artifactId >
14+ <version >1.4.7.RELEASE</version >
15+ </parent >
16+
17+ <properties >
18+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
19+ <java .version>1.8</java .version>
20+ </properties >
21+
22+ <dependencies >
23+ <dependency >
24+ <groupId >org.springframework.boot</groupId >
25+ <artifactId >spring-boot-starter-web</artifactId >
26+ </dependency >
27+ </dependencies >
28+
29+ <!-- 引入spring cloud的依赖 -->
30+ <dependencyManagement >
31+ <dependencies >
32+ <dependency >
33+ <groupId >org.springframework.cloud</groupId >
34+ <artifactId >spring-cloud-dependencies</artifactId >
35+ <version >Camden.SR4</version >
36+ <type >pom</type >
37+ <scope >import</scope >
38+ </dependency >
39+ </dependencies >
40+ </dependencyManagement >
41+
42+ <!-- 添加spring-boot的maven插件 -->
43+ <build >
44+ <plugins >
45+ <plugin >
46+ <groupId >org.springframework.boot</groupId >
47+ <artifactId >spring-boot-maven-plugin</artifactId >
48+ </plugin >
49+ </plugins >
50+ </build >
51+ </project >
Original file line number Diff line number Diff line change 1+ package com .monkey01 .apr ;
2+
3+ import org .apache .catalina .LifecycleListener ;
4+ import org .apache .catalina .core .AprLifecycleListener ;
5+ import org .springframework .boot .context .embedded .EmbeddedServletContainerFactory ;
6+ import org .springframework .boot .context .embedded .tomcat .TomcatEmbeddedServletContainerFactory ;
7+ import org .springframework .context .annotation .Bean ;
8+ import org .springframework .context .annotation .Configuration ;
9+
10+
11+ @ Configuration
12+ public class APRConfig {
13+ @ Bean
14+ public EmbeddedServletContainerFactory servletContainer () {
15+ TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory ();
16+ LifecycleListener aprLifecycle = new AprLifecycleListener ();
17+ container .setProtocol ("org.apache.coyote.http11.Http11AprProtocol" );
18+ container .addContextLifecycleListeners (aprLifecycle );
19+
20+ return container ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package com .monkey01 .apr ;
2+
3+ import org .springframework .boot .SpringApplication ;
4+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+ import org .springframework .boot .web .servlet .ServletComponentScan ;
6+
7+
8+ /**
9+ * @Author: feiweiwei
10+ * @Description:
11+ * @Created Date: 17:59 17/9/5.
12+ * @Modify by:
13+ */
14+ @ SpringBootApplication
15+ @ ServletComponentScan
16+ public class Application {
17+
18+ public static void main (String [] args ) {
19+ SpringApplication .run (Application .class , args );
20+ }
21+
22+
23+ }
Original file line number Diff line number Diff line change 1+ server :
2+ port : 8089
You can’t perform that action at this time.
0 commit comments