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

Commit e9d063f

Browse files
committed
Add SPR-9374
1 parent 01914f7 commit e9d063f

File tree

12 files changed

+434
-0
lines changed

12 files changed

+434
-0
lines changed

SPR-9374/pom.xml

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
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-9374</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>Spring MVC Issue Reproduction Project</name>
8+
<packaging>war</packaging>
9+
10+
<properties>
11+
<java-version>1.6</java-version>
12+
<org.springframework-version>3.2.0.BUILD-SNAPSHOT</org.springframework-version>
13+
<org.slf4j-version>1.6.1</org.slf4j-version>
14+
</properties>
15+
16+
<dependencies>
17+
<!-- Spring Framework -->
18+
<dependency>
19+
<groupId>org.springframework</groupId>
20+
<artifactId>spring-context</artifactId>
21+
<version>${org.springframework-version}</version>
22+
<exclusions>
23+
<!-- Exclude Commons Logging in favor of SLF4j -->
24+
<exclusion>
25+
<groupId>commons-logging</groupId>
26+
<artifactId>commons-logging</artifactId>
27+
</exclusion>
28+
</exclusions>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework</groupId>
32+
<artifactId>spring-webmvc</artifactId>
33+
<version>${org.springframework-version}</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.springframework</groupId>
37+
<artifactId>spring-tx</artifactId>
38+
<version>${org.springframework-version}</version>
39+
</dependency>
40+
41+
<!-- Logging -->
42+
<dependency>
43+
<groupId>org.slf4j</groupId>
44+
<artifactId>slf4j-api</artifactId>
45+
<version>${org.slf4j-version}</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.slf4j</groupId>
49+
<artifactId>jcl-over-slf4j</artifactId>
50+
<version>${org.slf4j-version}</version>
51+
<scope>runtime</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>org.slf4j</groupId>
55+
<artifactId>slf4j-log4j12</artifactId>
56+
<version>${org.slf4j-version}</version>
57+
<scope>runtime</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>log4j</groupId>
61+
<artifactId>log4j</artifactId>
62+
<version>1.2.16</version>
63+
<scope>runtime</scope>
64+
</dependency>
65+
66+
<!-- Servlet API -->
67+
<dependency>
68+
<groupId>javax.servlet</groupId>
69+
<artifactId>servlet-api</artifactId>
70+
<version>2.5</version>
71+
<scope>provided</scope>
72+
</dependency>
73+
74+
<!-- JSP API and JSTL
75+
<dependency>
76+
<groupId>javax.servlet.jsp</groupId>
77+
<artifactId>jsp-api</artifactId>
78+
<version>2.1</version>
79+
<scope>provided</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>javax.servlet</groupId>
83+
<artifactId>jstl</artifactId>
84+
<version>1.2</version>
85+
</dependency>
86+
-->
87+
88+
<!-- Apache Tiles
89+
<dependency>
90+
<groupId>org.apache.tiles</groupId>
91+
<artifactId>tiles-jsp</artifactId>
92+
<version>2.1.3</version>
93+
<exclusions>
94+
<exclusion>
95+
<groupId>commons-logging</groupId>
96+
<artifactId>commons-logging-api</artifactId>
97+
</exclusion>
98+
</exclusions>
99+
</dependency>
100+
-->
101+
102+
<!-- JSR 303 with Hibernate Validator
103+
<dependency>
104+
<groupId>javax.validation</groupId>
105+
<artifactId>validation-api</artifactId>
106+
<version>1.0.0.GA</version>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.hibernate</groupId>
110+
<artifactId>hibernate-validator</artifactId>
111+
<version>4.1.0.Final</version>
112+
</dependency>
113+
-->
114+
115+
<!-- Joda Time Library
116+
<dependency>
117+
<groupId>joda-time</groupId>
118+
<artifactId>joda-time</artifactId>
119+
<version>1.6.2</version>
120+
</dependency>
121+
<dependency>
122+
<groupId>joda-time</groupId>
123+
<artifactId>joda-time-jsptags</artifactId>
124+
<version>1.0.2</version>
125+
<scope>runtime</scope>
126+
</dependency>
127+
-->
128+
129+
<!-- Apache Commons File Upload
130+
<dependency>
131+
<groupId>commons-fileupload</groupId>
132+
<artifactId>commons-fileupload</artifactId>
133+
<version>1.2.2</version>
134+
</dependency>
135+
<dependency>
136+
<groupId>commons-io</groupId>
137+
<artifactId>commons-io</artifactId>
138+
<version>2.0.1</version>
139+
</dependency>
140+
-->
141+
142+
<!-- Jackson JSON Processor
143+
<dependency>
144+
<groupId>org.codehaus.jackson</groupId>
145+
<artifactId>jackson-mapper-asl</artifactId>
146+
<version>1.8.1</version>
147+
</dependency>
148+
-->
149+
150+
<!-- Rome Atom+RSS
151+
<dependency>
152+
<groupId>rome</groupId>
153+
<artifactId>rome</artifactId>
154+
<version>1.0</version>
155+
</dependency>
156+
-->
157+
158+
<!-- Test -->
159+
<dependency>
160+
<groupId>junit</groupId>
161+
<artifactId>junit</artifactId>
162+
<version>4.8</version>
163+
<scope>test</scope>
164+
</dependency>
165+
</dependencies>
166+
167+
<repositories>
168+
<repository>
169+
<id>spring-maven-snapshot</id>
170+
<name>Springframework Maven Snapshot Repository</name>
171+
<url>http://repo.springsource.org/snapshot</url>
172+
<snapshots>
173+
<enabled>true</enabled>
174+
</snapshots>
175+
</repository>
176+
</repositories>
177+
178+
<build>
179+
<plugins>
180+
<plugin>
181+
<artifactId>maven-compiler-plugin</artifactId>
182+
<configuration>
183+
<source>${java-version}</source>
184+
<target>${java-version}</target>
185+
</configuration>
186+
</plugin>
187+
<plugin>
188+
<groupId>org.apache.maven.plugins</groupId>
189+
<artifactId>maven-dependency-plugin</artifactId>
190+
<executions>
191+
<execution>
192+
<id>install</id>
193+
<phase>install</phase>
194+
<goals>
195+
<goal>sources</goal>
196+
</goals>
197+
</execution>
198+
</executions>
199+
</plugin>
200+
<plugin>
201+
<groupId>org.apache.maven.plugins</groupId>
202+
<artifactId>maven-eclipse-plugin</artifactId>
203+
<version>2.8</version>
204+
<configuration>
205+
<downloadSources>true</downloadSources>
206+
<downloadJavadocs>false</downloadJavadocs>
207+
<wtpversion>2.0</wtpversion>
208+
</configuration>
209+
</plugin>
210+
<plugin>
211+
<artifactId>maven-surefire-plugin</artifactId>
212+
<configuration>
213+
<includes>
214+
<include>**/*Tests.java</include>
215+
</includes>
216+
<excludes>
217+
<exclude>**/*Abstract*.java</exclude>
218+
</excludes>
219+
</configuration>
220+
</plugin>
221+
</plugins>
222+
</build>
223+
224+
</project>
225+

SPR-9374/src/main/java/org/springframework/issues/.gitignore

Whitespace-only changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package org.springframework.issues;
2+
3+
import org.springframework.transaction.TransactionDefinition;
4+
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
5+
import org.springframework.transaction.support.DefaultTransactionStatus;
6+
7+
/**
8+
* @author Rod Johnson
9+
* @author Juergen Hoeller
10+
*/
11+
@SuppressWarnings("serial")
12+
public class CallCountingTransactionManager extends AbstractPlatformTransactionManager {
13+
14+
public TransactionDefinition lastDefinition;
15+
public int begun;
16+
public int commits;
17+
public int rollbacks;
18+
public int inflight;
19+
20+
protected Object doGetTransaction() {
21+
return new Object();
22+
}
23+
24+
protected void doBegin(Object transaction, TransactionDefinition definition) {
25+
this.lastDefinition = definition;
26+
++begun;
27+
++inflight;
28+
}
29+
30+
protected void doCommit(DefaultTransactionStatus status) {
31+
++commits;
32+
--inflight;
33+
}
34+
35+
protected void doRollback(DefaultTransactionStatus status) {
36+
++rollbacks;
37+
--inflight;
38+
}
39+
40+
public void clear() {
41+
begun = commits = rollbacks = inflight = 0;
42+
}
43+
44+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2002-2012 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+
17+
package org.springframework.issues;
18+
19+
import org.springframework.stereotype.Controller;
20+
import org.springframework.transaction.annotation.Transactional;
21+
import org.springframework.web.bind.annotation.RequestMapping;
22+
import org.springframework.web.bind.annotation.RequestMethod;
23+
import org.springframework.web.bind.annotation.ResponseBody;
24+
25+
// If @Controller is not present here, the controller won't be discovered by
26+
// RequestMappingHandlerMapping since it is a proxy and only annotations on
27+
// the interface are available.
28+
29+
@Controller
30+
@RequestMapping( "/example")
31+
public interface ExampleAdapter {
32+
33+
@RequestMapping( value = "/echo", method = RequestMethod.GET)
34+
@ResponseBody
35+
@Transactional( readOnly = true )
36+
public String echo();
37+
38+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2002-2012 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+
17+
package org.springframework.issues;
18+
19+
import java.util.Locale;
20+
21+
import org.springframework.stereotype.Controller;
22+
23+
@Controller
24+
public class ExampleController implements ExampleAdapter {
25+
26+
public String echo() {
27+
return Long.toHexString(System.currentTimeMillis()).toUpperCase(Locale.US);
28+
}
29+
30+
}
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="
5+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
6+
7+
<!-- Root Context: defines shared resources visible to all other web components -->
8+
9+
</beans>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:mvc="http://www.springframework.org/schema/mvc"
5+
xmlns:context="http://www.springframework.org/schema/context"
6+
xmlns:tx="http://www.springframework.org/schema/tx"
7+
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
8+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
9+
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
10+
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
11+
12+
<context:component-scan base-package="org.springframework.issues"/>
13+
14+
<tx:annotation-driven mode="proxy" transaction-manager="transactionManager"/>
15+
16+
<bean id="transactionManager" class="org.springframework.issues.CallCountingTransactionManager"/>
17+
18+
<mvc:annotation-driven />
19+
20+
<mvc:view-controller path="/" view-name="home" />
21+
22+
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
23+
<property name="prefix" value="/WEB-INF/views/" />
24+
<property name="suffix" value=".jsp" />
25+
</bean>
26+
27+
</beans>

0 commit comments

Comments
 (0)