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

Commit 4c417a5

Browse files
committed
Repro project for SPR-13565
1 parent 200c3fd commit 4c417a5

File tree

8 files changed

+386
-0
lines changed

8 files changed

+386
-0
lines changed

SPR-13565/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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. See the next two sections on Cargo and Jetty.
16+
17+
### Cargo
18+
19+
You can deploy with the [Cargo Maven plugin](http://cargo.codehaus.org/) which
20+
supports a wide [range of servers](http://cargo.codehaus.org/Containers).
21+
The required command is `mvn package cargo:run`.
22+
23+
By default Cargo is configured to start with `Tomcat 8` but you can easily
24+
edit the plugin settings in `pom.xml` to switch to a different server
25+
and version. The pom.xml or to switch to debug settings.
26+
27+
### Jetty
28+
29+
You can also deploy with the
30+
[Jetty Maven plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html).
31+
The required command is `mvn jetty:run` or `mvnDebug jetty:run`.
32+
33+
## Logging
34+
35+
This project contains a `log4j.properties` file in `src/main/resources` that you
36+
may wish to configure to emit more detailed logging. The root logger is set to
37+
`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`.

SPR-13565/pom.xml

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
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-13565</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+
<java.version>1.6</java.version>
13+
<spring.version>4.2.1.RELEASE</spring.version>
14+
<slf4j.version>1.7.12</slf4j.version>
15+
</properties>
16+
17+
<dependencies>
18+
<!-- Spring Framework -->
19+
<dependency>
20+
<groupId>org.springframework</groupId>
21+
<artifactId>spring-context</artifactId>
22+
<version>${spring.version}</version>
23+
<exclusions>
24+
<!-- Exclude Commons Logging in favor of SLF4j -->
25+
<exclusion>
26+
<groupId>commons-logging</groupId>
27+
<artifactId>commons-logging</artifactId>
28+
</exclusion>
29+
</exclusions>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework</groupId>
33+
<artifactId>spring-webmvc</artifactId>
34+
<version>${spring.version}</version>
35+
</dependency>
36+
37+
<!-- Logging -->
38+
<dependency>
39+
<groupId>org.slf4j</groupId>
40+
<artifactId>slf4j-api</artifactId>
41+
<version>${slf4j.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.slf4j</groupId>
45+
<artifactId>jcl-over-slf4j</artifactId>
46+
<version>${slf4j.version}</version>
47+
<scope>runtime</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.slf4j</groupId>
51+
<artifactId>slf4j-log4j12</artifactId>
52+
<version>${slf4j.version}</version>
53+
<scope>runtime</scope>
54+
</dependency>
55+
<dependency>
56+
<groupId>log4j</groupId>
57+
<artifactId>log4j</artifactId>
58+
<version>1.2.17</version>
59+
<scope>runtime</scope>
60+
</dependency>
61+
62+
<!-- Servlet API -->
63+
<dependency>
64+
<groupId>javax.servlet</groupId>
65+
<artifactId>javax.servlet-api</artifactId>
66+
<version>3.0.1</version>
67+
<scope>provided</scope>
68+
</dependency>
69+
70+
<!-- JSP API and JSTL
71+
<dependency>
72+
<groupId>javax.servlet.jsp</groupId>
73+
<artifactId>jsp-api</artifactId>
74+
<version>2.1</version>
75+
<scope>provided</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>javax.servlet</groupId>
79+
<artifactId>jstl</artifactId>
80+
<version>1.2</version>
81+
</dependency>
82+
-->
83+
84+
<!-- Apache Tiles
85+
<dependency>
86+
<groupId>org.apache.tiles</groupId>
87+
<artifactId>tiles-jsp</artifactId>
88+
<version>2.1.3</version>
89+
<exclusions>
90+
<exclusion>
91+
<groupId>commons-logging</groupId>
92+
<artifactId>commons-logging-api</artifactId>
93+
</exclusion>
94+
</exclusions>
95+
</dependency>
96+
-->
97+
98+
<!-- JSR 303 with Hibernate Validator
99+
<dependency>
100+
<groupId>javax.validation</groupId>
101+
<artifactId>validation-api</artifactId>
102+
<version>1.0.0.GA</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.hibernate</groupId>
106+
<artifactId>hibernate-validator</artifactId>
107+
<version>4.1.0.Final</version>
108+
</dependency>
109+
-->
110+
111+
<!-- Joda Time Library
112+
<dependency>
113+
<groupId>joda-time</groupId>
114+
<artifactId>joda-time</artifactId>
115+
<version>1.6.2</version>
116+
</dependency>
117+
<dependency>
118+
<groupId>joda-time</groupId>
119+
<artifactId>joda-time-jsptags</artifactId>
120+
<version>1.0.2</version>
121+
<scope>runtime</scope>
122+
</dependency>
123+
-->
124+
125+
<!-- Apache Commons File Upload
126+
<dependency>
127+
<groupId>commons-fileupload</groupId>
128+
<artifactId>commons-fileupload</artifactId>
129+
<version>1.2.2</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>commons-io</groupId>
133+
<artifactId>commons-io</artifactId>
134+
<version>2.0.1</version>
135+
</dependency>
136+
-->
137+
138+
<!-- Jackson JSON Processor
139+
<dependency>
140+
<groupId>com.fasterxml.jackson.core</groupId>
141+
<artifactId>jackson-databind</artifactId>
142+
<version>2.6.2</version>
143+
</dependency>
144+
-->
145+
146+
<!-- Rome Atom+RSS
147+
<dependency>
148+
<groupId>rome</groupId>
149+
<artifactId>rome</artifactId>
150+
<version>1.0</version>
151+
</dependency>
152+
-->
153+
154+
<!-- Test -->
155+
<dependency>
156+
<groupId>junit</groupId>
157+
<artifactId>junit</artifactId>
158+
<version>4.12</version>
159+
<scope>test</scope>
160+
</dependency>
161+
</dependencies>
162+
163+
<build>
164+
<plugins>
165+
<plugin>
166+
<groupId>org.apache.maven.plugins</groupId>
167+
<artifactId>maven-compiler-plugin</artifactId>
168+
<version>2.5.1</version>
169+
<configuration>
170+
<source>${java.version}</source>
171+
<target>${java.version}</target>
172+
</configuration>
173+
</plugin>
174+
<plugin>
175+
<groupId>org.apache.maven.plugins</groupId>
176+
<artifactId>maven-dependency-plugin</artifactId>
177+
<version>2.8</version>
178+
<executions>
179+
<execution>
180+
<id>install</id>
181+
<phase>install</phase>
182+
<goals>
183+
<goal>sources</goal>
184+
</goals>
185+
</execution>
186+
</executions>
187+
</plugin>
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-eclipse-plugin</artifactId>
191+
<version>2.8</version>
192+
<configuration>
193+
<downloadSources>true</downloadSources>
194+
<downloadJavadocs>false</downloadJavadocs>
195+
<wtpversion>2.0</wtpversion>
196+
</configuration>
197+
</plugin>
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-surefire-plugin</artifactId>
201+
<version>2.12.4</version>
202+
<configuration>
203+
<includes>
204+
<include>**/*Tests.java</include>
205+
<include>**/*Test.java</include>
206+
</includes>
207+
<excludes>
208+
<exclude>**/*Abstract*.java</exclude>
209+
</excludes>
210+
</configuration>
211+
</plugin>
212+
<plugin>
213+
<groupId>org.eclipse.jetty</groupId>
214+
<artifactId>jetty-maven-plugin</artifactId>
215+
<!-- <version>9.0.0.v20130308</version> -->
216+
<version>9.0.0.M3</version>
217+
</plugin>
218+
<plugin>
219+
<groupId>org.codehaus.cargo</groupId>
220+
<artifactId>cargo-maven2-plugin</artifactId>
221+
<version>1.4.7</version>
222+
<configuration>
223+
<configuration>
224+
<properties>
225+
<cargo.servlet.port>8080</cargo.servlet.port>
226+
<cargo.logging>medium</cargo.logging>
227+
<cargo.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.jvmargs>
228+
<!--
229+
<cargo.jvmargs>
230+
-Xdebug
231+
-Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y
232+
-Xnoagent
233+
-Djava.compiler=NONE
234+
</cargo.jvmargs>
235+
-->
236+
</properties>
237+
</configuration>
238+
<container>
239+
<containerId>tomcat8x</containerId>
240+
<zipUrlInstaller>
241+
<url>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.26/bin/apache-tomcat-8.0.26.zip</url>
242+
</zipUrlInstaller>
243+
</container>
244+
</configuration>
245+
</plugin>
246+
</plugins>
247+
</build>
248+
249+
<repositories>
250+
<repository>
251+
<id>spring-maven-snapshot</id>
252+
<name>Springframework Maven Snapshot Repository</name>
253+
<url>http://repo.spring.io/snapshot</url>
254+
<snapshots>
255+
<enabled>true</enabled>
256+
</snapshots>
257+
</repository>
258+
</repositories>
259+
260+
</project>
261+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.springframework.issues;
2+
3+
import org.springframework.http.ResponseEntity;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
/**
8+
* @author Brian Clozel
9+
*/
10+
@RestController
11+
public class TestController {
12+
13+
@RequestMapping("/")
14+
public ResponseEntity<String> test() {
15+
return ResponseEntity.ok("test");
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.springframework.issues.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.ComponentScan;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7+
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
8+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
9+
import org.springframework.web.servlet.view.InternalResourceViewResolver;
10+
11+
@EnableWebMvc
12+
@ComponentScan(basePackages="org.springframework.issues")
13+
@Configuration
14+
public class WebConfig extends WebMvcConfigurerAdapter {
15+
16+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
log4j.rootCategory=INFO, stdout
2+
3+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5+
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
6+
7+
log4j.category.org.springframework.web=DEBUG
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
5+
6+
<context-param>
7+
<param-name>contextClass</param-name>
8+
<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
9+
</context-param>
10+
11+
<context-param>
12+
<param-name>contextConfigLocation</param-name>
13+
<param-value>org.springframework.issues.config</param-value>
14+
</context-param>
15+
16+
<listener>
17+
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
18+
</listener>
19+
20+
<servlet>
21+
<servlet-name>appServlet</servlet-name>
22+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
23+
<init-param>
24+
<param-name>contextConfigLocation</param-name>
25+
<param-value></param-value>
26+
</init-param>
27+
<load-on-startup>1</load-on-startup>
28+
</servlet>
29+
30+
<servlet-mapping>
31+
<servlet-name>appServlet</servlet-name>
32+
<url-pattern>/</url-pattern>
33+
</servlet-mapping>
34+
35+
<!-- Disables Servlet Container welcome file handling. Needed for compatibility
36+
with Servlet 3.0 and Tomcat 7.0 -->
37+
<welcome-file-list>
38+
<welcome-file></welcome-file>
39+
</welcome-file-list>
40+
41+
</web-app>

SPR-13565/src/test/java/org/springframework/issues/.gitignore

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
log4j.rootCategory=INFO, stdout
2+
3+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5+
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
6+
7+
log4j.category.org.springframework.web=DEBUG

0 commit comments

Comments
 (0)