Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit aeed125

Browse files
committed
Add repro project for SPR-11660
1 parent 216f632 commit aeed125

File tree

12 files changed

+1056
-0
lines changed

12 files changed

+1056
-0
lines changed

SPR-11660/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Spring MVC project with Java config
2+
3+
This is a simple template for creating issue reproduction projects per
4+
the [README in the root of this repository](https://github.com/spring-projects/spring-framework-issues#readme).
5+
Please review that document before starting.
6+
7+
As described at the link above, do not edit this project directly! Rather
8+
use the `./create-repro-project.sh` script to create a fresh copy to
9+
a new directory having the same name as the JIRA issue you're trying
10+
to reproduce and edit from there.
11+
12+
## Deploying
13+
14+
It is possible to deploy your application directly from the command-line
15+
using maven. You can use either [cargo](http://cargo.codehaus.org/) or
16+
the [jetty plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html)
17+
to run on a wide range of containers.
18+
19+
### Cargo
20+
21+
By default Cargo is configured to start `Tomcat7` and can be invoked by
22+
running `mvn package cargo:run`. Cargo can also run a [wide range of other
23+
containers](http://cargo.codehaus.org/Containers) and you can easily add
24+
yours by editing the `pom.xml`. For instance, a `tomcat8` profile
25+
has been added and can be invoked via `mvn package cargo:run -Ptomcat8`.
26+
27+
### Jetty
28+
29+
To deploy your application to jetty9, simply invoke `mvn jetty:run`. It
30+
is possible to tune the exact jetty9 version you want to use by specifying
31+
the version of the command line, e.g. `mvn jetty:run -Djetty.version=9.0.6.v20130930`
32+
33+
To run a different version of jetty, please fallback to cargo as the
34+
coordinates of the maven plugin have changed. A sample `jetty8` profile is
35+
created for reference and can be tuned to suit your needs. To deploy your
36+
sample application to jetty8 run `mvn cargo:run -Pjetty8`
37+
38+
## Logging
39+
40+
This project contains a `log4j.properties` file in `src/main/resources` that you
41+
may wish to configure to emit more detailed logging. The root logger is set to
42+
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`.

SPR-11660/pom.xml

Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
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/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.springframework.issues</groupId>
5+
<artifactId>SPR-11660</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>Spring MVC Issue Reproduction Project</name>
8+
<packaging>war</packaging>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
13+
<java.version>1.8</java.version>
14+
<spring.version>4.1.0.BUILD-SNAPSHOT</spring.version>
15+
<slf4j.version>1.7.5</slf4j.version>
16+
17+
<jetty.version>9.1.2.v20140210</jetty.version>
18+
<cargo.container.id>tomcat7x</cargo.container.id>
19+
<cargo.container.url>
20+
http://www.eu.apache.org/dist/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.zip
21+
</cargo.container.url>
22+
</properties>
23+
24+
<dependencies>
25+
<!-- Spring Framework -->
26+
<dependency>
27+
<groupId>org.springframework</groupId>
28+
<artifactId>spring-context</artifactId>
29+
<version>${spring.version}</version>
30+
<exclusions>
31+
<!-- Exclude Commons Logging in favor of SLF4j -->
32+
<exclusion>
33+
<groupId>commons-logging</groupId>
34+
<artifactId>commons-logging</artifactId>
35+
</exclusion>
36+
</exclusions>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework</groupId>
40+
<artifactId>spring-webmvc</artifactId>
41+
<version>${spring.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.springframework</groupId>
45+
<artifactId>spring-websocket</artifactId>
46+
<version>${spring.version}</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework</groupId>
50+
<artifactId>spring-messaging</artifactId>
51+
<version>${spring.version}</version>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>org.projectreactor</groupId>
56+
<artifactId>reactor-net</artifactId>
57+
<version>1.1.2.RELEASE</version>
58+
</dependency>
59+
60+
61+
<!-- CGLIB, required for @Configuration usage -->
62+
<dependency>
63+
<groupId>cglib</groupId>
64+
<artifactId>cglib-nodep</artifactId>
65+
<version>2.2</version>
66+
</dependency>
67+
68+
<!-- Logging -->
69+
<dependency>
70+
<groupId>org.slf4j</groupId>
71+
<artifactId>slf4j-api</artifactId>
72+
<version>${slf4j.version}</version>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.slf4j</groupId>
76+
<artifactId>jcl-over-slf4j</artifactId>
77+
<version>${slf4j.version}</version>
78+
<scope>runtime</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.slf4j</groupId>
82+
<artifactId>slf4j-log4j12</artifactId>
83+
<version>${slf4j.version}</version>
84+
<scope>runtime</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>log4j</groupId>
88+
<artifactId>log4j</artifactId>
89+
<version>1.2.17</version>
90+
<scope>runtime</scope>
91+
</dependency>
92+
93+
<!-- Servlet API -->
94+
<dependency>
95+
<groupId>javax.servlet</groupId>
96+
<artifactId>servlet-api</artifactId>
97+
<version>2.5</version>
98+
<scope>provided</scope>
99+
</dependency>
100+
101+
<!-- JSP API and JSTL
102+
<dependency>
103+
<groupId>javax.servlet.jsp</groupId>
104+
<artifactId>jsp-api</artifactId>
105+
<version>2.1</version>
106+
<scope>provided</scope>
107+
</dependency>
108+
<dependency>
109+
<groupId>javax.servlet</groupId>
110+
<artifactId>jstl</artifactId>
111+
<version>1.2</version>
112+
</dependency>
113+
-->
114+
115+
<!-- Apache Tiles
116+
<dependency>
117+
<groupId>org.apache.tiles</groupId>
118+
<artifactId>tiles-jsp</artifactId>
119+
<version>2.1.3</version>
120+
<exclusions>
121+
<exclusion>
122+
<groupId>commons-logging</groupId>
123+
<artifactId>commons-logging-api</artifactId>
124+
</exclusion>
125+
</exclusions>
126+
</dependency>
127+
-->
128+
129+
<!-- JSR 303 with Hibernate Validator
130+
<dependency>
131+
<groupId>javax.validation</groupId>
132+
<artifactId>validation-api</artifactId>
133+
<version>1.0.0.GA</version>
134+
</dependency>
135+
<dependency>
136+
<groupId>org.hibernate</groupId>
137+
<artifactId>hibernate-validator</artifactId>
138+
<version>4.1.0.Final</version>
139+
</dependency>
140+
-->
141+
142+
<!-- Joda Time Library
143+
<dependency>
144+
<groupId>joda-time</groupId>
145+
<artifactId>joda-time</artifactId>
146+
<version>1.6.2</version>
147+
</dependency>
148+
<dependency>
149+
<groupId>joda-time</groupId>
150+
<artifactId>joda-time-jsptags</artifactId>
151+
<version>1.0.2</version>
152+
<scope>runtime</scope>
153+
</dependency>
154+
-->
155+
156+
<!-- Apache Commons File Upload
157+
<dependency>
158+
<groupId>commons-fileupload</groupId>
159+
<artifactId>commons-fileupload</artifactId>
160+
<version>1.2.2</version>
161+
</dependency>
162+
<dependency>
163+
<groupId>commons-io</groupId>
164+
<artifactId>commons-io</artifactId>
165+
<version>2.0.1</version>
166+
</dependency>
167+
-->
168+
169+
<!-- Jackson JSON Processor
170+
<dependency>
171+
<groupId>org.codehaus.jackson</groupId>
172+
<artifactId>jackson-mapper-asl</artifactId>
173+
<version>1.8.1</version>
174+
</dependency>
175+
-->
176+
177+
<!-- Rome Atom+RSS
178+
<dependency>
179+
<groupId>rome</groupId>
180+
<artifactId>rome</artifactId>
181+
<version>1.0</version>
182+
</dependency>
183+
-->
184+
185+
<!-- Test -->
186+
<dependency>
187+
<groupId>junit</groupId>
188+
<artifactId>junit</artifactId>
189+
<version>4.11</version>
190+
<scope>test</scope>
191+
</dependency>
192+
</dependencies>
193+
194+
<build>
195+
<plugins>
196+
<plugin>
197+
<groupId>org.apache.maven.plugins</groupId>
198+
<artifactId>maven-compiler-plugin</artifactId>
199+
<version>2.5.1</version>
200+
<configuration>
201+
<source>${java.version}</source>
202+
<target>${java.version}</target>
203+
</configuration>
204+
</plugin>
205+
<plugin>
206+
<groupId>org.apache.maven.plugins</groupId>
207+
<artifactId>maven-dependency-plugin</artifactId>
208+
<version>2.8</version>
209+
<executions>
210+
<execution>
211+
<id>install</id>
212+
<phase>install</phase>
213+
<goals>
214+
<goal>sources</goal>
215+
</goals>
216+
</execution>
217+
</executions>
218+
</plugin>
219+
<plugin>
220+
<groupId>org.apache.maven.plugins</groupId>
221+
<artifactId>maven-eclipse-plugin</artifactId>
222+
<version>2.8</version>
223+
<configuration>
224+
<downloadSources>true</downloadSources>
225+
<downloadJavadocs>false</downloadJavadocs>
226+
<wtpversion>2.0</wtpversion>
227+
</configuration>
228+
</plugin>
229+
<plugin>
230+
<groupId>org.apache.maven.plugins</groupId>
231+
<artifactId>maven-surefire-plugin</artifactId>
232+
<version>2.12.4</version>
233+
<configuration>
234+
<includes>
235+
<include>**/*Tests.java</include>
236+
<include>**/*Test.java</include>
237+
</includes>
238+
<excludes>
239+
<exclude>**/*Abstract*.java</exclude>
240+
</excludes>
241+
</configuration>
242+
</plugin>
243+
<plugin>
244+
<groupId>org.eclipse.jetty</groupId>
245+
<artifactId>jetty-maven-plugin</artifactId>
246+
<version>${jetty.version}</version>
247+
</plugin>
248+
<plugin>
249+
<groupId>org.codehaus.cargo</groupId>
250+
<artifactId>cargo-maven2-plugin</artifactId>
251+
<version>1.4.7</version>
252+
<configuration>
253+
<configuration>
254+
<properties>
255+
<cargo.servlet.port>8080</cargo.servlet.port>
256+
<cargo.tomcat.ajp.port>1099</cargo.tomcat.ajp.port>
257+
<cargo.rmi.port>1099</cargo.rmi.port>
258+
<cargo.logging>medium</cargo.logging>
259+
<cargo.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.jvmargs>
260+
</properties>
261+
</configuration>
262+
<container>
263+
<containerId>${cargo.container.id}</containerId>
264+
<zipUrlInstaller>
265+
<url>${cargo.container.url}</url>
266+
</zipUrlInstaller>
267+
</container>
268+
</configuration>
269+
</plugin>
270+
</plugins>
271+
</build>
272+
273+
<profiles>
274+
<profile>
275+
<id>tomcat8</id>
276+
<properties>
277+
<cargo.container.id>tomcat8x</cargo.container.id>
278+
<cargo.container.url>
279+
http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.3/bin/apache-tomcat-8.0.3.zip
280+
</cargo.container.url>
281+
</properties>
282+
</profile>
283+
<profile>
284+
<id>jetty8</id>
285+
<build>
286+
<plugins>
287+
<plugin>
288+
<groupId>org.codehaus.cargo</groupId>
289+
<artifactId>cargo-maven2-plugin</artifactId>
290+
<configuration>
291+
<container>
292+
<containerId>jetty8x</containerId>
293+
<type>embedded</type>
294+
</container>
295+
</configuration>
296+
</plugin>
297+
</plugins>
298+
</build>
299+
</profile>
300+
</profiles>
301+
302+
<repositories>
303+
<repository>
304+
<id>spring-maven-snapshot</id>
305+
<name>Springframework Maven Snapshot Repository</name>
306+
<url>http://repo.spring.io/snapshot</url>
307+
<snapshots>
308+
<enabled>true</enabled>
309+
</snapshots>
310+
</repository>
311+
</repositories>
312+
313+
</project>
314+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.springframework.issues.config;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.annotation.ImportResource;
6+
import org.springframework.web.servlet.config.annotation.*;
7+
8+
@EnableWebMvc
9+
@Configuration
10+
@ComponentScan(basePackages="org.springframework.issues")
11+
//@ImportResource("classpath:applicationContext.xml")
12+
public class WebConfig extends WebMvcConfigurerAdapter {
13+
14+
@Override
15+
public void addViewControllers(ViewControllerRegistry registry) {
16+
registry.addViewController("/").setViewName("/index.html");
17+
}
18+
19+
@Override
20+
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
21+
configurer.enable();
22+
}
23+
}

0 commit comments

Comments
 (0)