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

Commit 337ce3c

Browse files
committed
Repro project for SPR-15325
1 parent 271d71a commit 337ce3c

File tree

10 files changed

+504
-0
lines changed

10 files changed

+504
-0
lines changed

Diff for: SPR-15325/README.md

+37
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`.

Diff for: SPR-15325/pom.xml

+270
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
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-15325</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.3.5.RELEASE</spring.version>
14+
<slf4j.version>1.7.22</slf4j.version>
15+
<tomcat.version>8.5.9</tomcat.version>
16+
</properties>
17+
18+
<dependencies>
19+
<!-- Spring Framework -->
20+
<dependency>
21+
<groupId>org.springframework</groupId>
22+
<artifactId>spring-context</artifactId>
23+
<version>${spring.version}</version>
24+
<exclusions>
25+
<!-- Exclude Commons Logging in favor of SLF4j -->
26+
<exclusion>
27+
<groupId>commons-logging</groupId>
28+
<artifactId>commons-logging</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.springframework</groupId>
34+
<artifactId>spring-webmvc</artifactId>
35+
<version>${spring.version}</version>
36+
</dependency>
37+
38+
<!-- Logging -->
39+
<dependency>
40+
<groupId>org.slf4j</groupId>
41+
<artifactId>slf4j-api</artifactId>
42+
<version>${slf4j.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.slf4j</groupId>
46+
<artifactId>jcl-over-slf4j</artifactId>
47+
<version>${slf4j.version}</version>
48+
<scope>runtime</scope>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.slf4j</groupId>
52+
<artifactId>slf4j-log4j12</artifactId>
53+
<version>${slf4j.version}</version>
54+
<scope>runtime</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>log4j</groupId>
58+
<artifactId>log4j</artifactId>
59+
<version>1.2.17</version>
60+
<scope>runtime</scope>
61+
</dependency>
62+
63+
<!-- Servlet API -->
64+
<dependency>
65+
<groupId>javax.servlet</groupId>
66+
<artifactId>javax.servlet-api</artifactId>
67+
<version>3.1.0</version>
68+
<scope>provided</scope>
69+
</dependency>
70+
71+
<!-- JSP API and JSTL
72+
<dependency>
73+
<groupId>javax.servlet.jsp</groupId>
74+
<artifactId>jsp-api</artifactId>
75+
<version>2.1</version>
76+
<scope>provided</scope>
77+
</dependency>
78+
<dependency>
79+
<groupId>javax.servlet</groupId>
80+
<artifactId>jstl</artifactId>
81+
<version>1.2</version>
82+
</dependency>
83+
-->
84+
85+
<!-- Apache Tiles
86+
<dependency>
87+
<groupId>org.apache.tiles</groupId>
88+
<artifactId>tiles-jsp</artifactId>
89+
<version>2.1.3</version>
90+
<exclusions>
91+
<exclusion>
92+
<groupId>commons-logging</groupId>
93+
<artifactId>commons-logging-api</artifactId>
94+
</exclusion>
95+
</exclusions>
96+
</dependency>
97+
-->
98+
99+
<!-- JSR 303 with Hibernate Validator
100+
<dependency>
101+
<groupId>javax.validation</groupId>
102+
<artifactId>validation-api</artifactId>
103+
<version>1.0.0.GA</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>org.hibernate</groupId>
107+
<artifactId>hibernate-validator</artifactId>
108+
<version>4.1.0.Final</version>
109+
</dependency>
110+
-->
111+
112+
<!-- Joda Time Library
113+
<dependency>
114+
<groupId>joda-time</groupId>
115+
<artifactId>joda-time</artifactId>
116+
<version>1.6.2</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>joda-time</groupId>
120+
<artifactId>joda-time-jsptags</artifactId>
121+
<version>1.0.2</version>
122+
<scope>runtime</scope>
123+
</dependency>
124+
-->
125+
126+
<!-- Apache Commons File Upload
127+
<dependency>
128+
<groupId>commons-fileupload</groupId>
129+
<artifactId>commons-fileupload</artifactId>
130+
<version>1.2.2</version>
131+
</dependency>
132+
<dependency>
133+
<groupId>commons-io</groupId>
134+
<artifactId>commons-io</artifactId>
135+
<version>2.0.1</version>
136+
</dependency>
137+
-->
138+
139+
<dependency>
140+
<groupId>com.fasterxml.jackson.core</groupId>
141+
<artifactId>jackson-databind</artifactId>
142+
<version>2.9.0.pr1</version>
143+
</dependency>
144+
145+
<dependency>
146+
<groupId>com.fasterxml.jackson.dataformat</groupId>
147+
<artifactId>jackson-dataformat-xml</artifactId>
148+
<version>2.9.0.pr1</version>
149+
</dependency>
150+
151+
<!-- Rome Atom+RSS
152+
<dependency>
153+
<groupId>rome</groupId>
154+
<artifactId>rome</artifactId>
155+
<version>1.0</version>
156+
</dependency>
157+
-->
158+
159+
<dependency>
160+
<groupId>org.springframework</groupId>
161+
<artifactId>spring-test</artifactId>
162+
<version>${spring.version}</version>
163+
</dependency>
164+
165+
<dependency>
166+
<groupId>junit</groupId>
167+
<artifactId>junit</artifactId>
168+
<version>4.12</version>
169+
<scope>test</scope>
170+
</dependency>
171+
</dependencies>
172+
173+
<build>
174+
<plugins>
175+
<plugin>
176+
<groupId>org.apache.maven.plugins</groupId>
177+
<artifactId>maven-compiler-plugin</artifactId>
178+
<version>2.5.1</version>
179+
<configuration>
180+
<source>${java.version}</source>
181+
<target>${java.version}</target>
182+
</configuration>
183+
</plugin>
184+
<plugin>
185+
<groupId>org.apache.maven.plugins</groupId>
186+
<artifactId>maven-dependency-plugin</artifactId>
187+
<version>2.8</version>
188+
<executions>
189+
<execution>
190+
<id>install</id>
191+
<phase>install</phase>
192+
<goals>
193+
<goal>sources</goal>
194+
</goals>
195+
</execution>
196+
</executions>
197+
</plugin>
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-eclipse-plugin</artifactId>
201+
<version>2.8</version>
202+
<configuration>
203+
<downloadSources>true</downloadSources>
204+
<downloadJavadocs>false</downloadJavadocs>
205+
<wtpversion>2.0</wtpversion>
206+
</configuration>
207+
</plugin>
208+
<plugin>
209+
<groupId>org.apache.maven.plugins</groupId>
210+
<artifactId>maven-surefire-plugin</artifactId>
211+
<version>2.12.4</version>
212+
<configuration>
213+
<includes>
214+
<include>**/*Tests.java</include>
215+
<include>**/*Test.java</include>
216+
</includes>
217+
<excludes>
218+
<exclude>**/*Abstract*.java</exclude>
219+
</excludes>
220+
</configuration>
221+
</plugin>
222+
<plugin>
223+
<groupId>org.eclipse.jetty</groupId>
224+
<artifactId>jetty-maven-plugin</artifactId>
225+
<version>9.3.3.v20150827</version>
226+
</plugin>
227+
<plugin>
228+
<groupId>org.codehaus.cargo</groupId>
229+
<artifactId>cargo-maven2-plugin</artifactId>
230+
<version>1.6.2</version>
231+
<configuration>
232+
<configuration>
233+
<properties>
234+
<cargo.servlet.port>8080</cargo.servlet.port>
235+
<cargo.logging>medium</cargo.logging>
236+
<cargo.jvmargs>-Xms96m -Xmx512m -Djava.awt.headless=true</cargo.jvmargs>
237+
<!--
238+
<cargo.jvmargs>
239+
-Xdebug
240+
-Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y
241+
-Xnoagent
242+
-Djava.compiler=NONE
243+
</cargo.jvmargs>
244+
-->
245+
</properties>
246+
</configuration>
247+
<container>
248+
<containerId>tomcat8x</containerId>
249+
<zipUrlInstaller>
250+
<url>http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
251+
</zipUrlInstaller>
252+
</container>
253+
</configuration>
254+
</plugin>
255+
</plugins>
256+
</build>
257+
258+
<repositories>
259+
<repository>
260+
<id>spring-maven-snapshot</id>
261+
<name>Springframework Maven Snapshot Repository</name>
262+
<url>http://repo.spring.io/snapshot</url>
263+
<snapshots>
264+
<enabled>true</enabled>
265+
</snapshots>
266+
</repository>
267+
</repositories>
268+
269+
</project>
270+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2002-2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.issues.config;
17+
18+
import java.util.ArrayList;
19+
import java.util.Arrays;
20+
import java.util.Collection;
21+
22+
import org.springframework.http.MediaType;
23+
import org.springframework.stereotype.Controller;
24+
import org.springframework.web.bind.annotation.GetMapping;
25+
import org.springframework.web.bind.annotation.RequestMapping;
26+
import org.springframework.web.bind.annotation.ResponseBody;
27+
28+
29+
@Controller
30+
@RequestMapping("/personas")
31+
public class PersonaRestController {
32+
33+
@GetMapping(produces={MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE})
34+
public @ResponseBody
35+
Collection<Persona> findAll(){
36+
Persona persona1 = new Persona();
37+
persona1.setNombre("p1");
38+
Persona persona2 = new Persona();
39+
persona2.setNombre("p2");
40+
return Arrays.asList(persona1, persona2);
41+
}
42+
43+
44+
static class Persona {
45+
46+
private String nombre;
47+
48+
public String getNombre() {
49+
return nombre;
50+
}
51+
52+
public void setNombre(String nombre) {
53+
this.nombre = nombre;
54+
}
55+
}
56+
57+
}

0 commit comments

Comments
 (0)