diff --git a/SPR-9374/pom.xml b/SPR-9374/pom.xml new file mode 100644 index 00000000..8ab88a77 --- /dev/null +++ b/SPR-9374/pom.xml @@ -0,0 +1,225 @@ + + 4.0.0 + org.springframework.issues + SPR-9374 + 1.0-SNAPSHOT + Spring MVC Issue Reproduction Project + war + + + 1.6 + 3.2.0.BUILD-SNAPSHOT + 1.6.1 + + + + + + org.springframework + spring-context + ${org.springframework-version} + + + + commons-logging + commons-logging + + + + + org.springframework + spring-webmvc + ${org.springframework-version} + + + org.springframework + spring-tx + ${org.springframework-version} + + + + + org.slf4j + slf4j-api + ${org.slf4j-version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j-version} + runtime + + + org.slf4j + slf4j-log4j12 + ${org.slf4j-version} + runtime + + + log4j + log4j + 1.2.16 + runtime + + + + + javax.servlet + servlet-api + 2.5 + provided + + + + + + + + + + + + + + + + + + + junit + junit + 4.8 + test + + + + + + spring-maven-snapshot + Springframework Maven Snapshot Repository + http://repo.springsource.org/snapshot + + true + + + + + + + + maven-compiler-plugin + + ${java-version} + ${java-version} + + + + org.apache.maven.plugins + maven-dependency-plugin + + + install + install + + sources + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.8 + + true + false + 2.0 + + + + maven-surefire-plugin + + + **/*Tests.java + + + **/*Abstract*.java + + + + + + + + diff --git a/SPR-9374/src/main/java/org/springframework/issues/.gitignore b/SPR-9374/src/main/java/org/springframework/issues/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/SPR-9374/src/main/java/org/springframework/issues/CallCountingTransactionManager.java b/SPR-9374/src/main/java/org/springframework/issues/CallCountingTransactionManager.java new file mode 100644 index 00000000..e1350e6f --- /dev/null +++ b/SPR-9374/src/main/java/org/springframework/issues/CallCountingTransactionManager.java @@ -0,0 +1,44 @@ +package org.springframework.issues; + +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.support.AbstractPlatformTransactionManager; +import org.springframework.transaction.support.DefaultTransactionStatus; + +/** + * @author Rod Johnson + * @author Juergen Hoeller + */ +@SuppressWarnings("serial") +public class CallCountingTransactionManager extends AbstractPlatformTransactionManager { + + public TransactionDefinition lastDefinition; + public int begun; + public int commits; + public int rollbacks; + public int inflight; + + protected Object doGetTransaction() { + return new Object(); + } + + protected void doBegin(Object transaction, TransactionDefinition definition) { + this.lastDefinition = definition; + ++begun; + ++inflight; + } + + protected void doCommit(DefaultTransactionStatus status) { + ++commits; + --inflight; + } + + protected void doRollback(DefaultTransactionStatus status) { + ++rollbacks; + --inflight; + } + + public void clear() { + begun = commits = rollbacks = inflight = 0; + } + +} \ No newline at end of file diff --git a/SPR-9374/src/main/java/org/springframework/issues/ExampleAdapter.java b/SPR-9374/src/main/java/org/springframework/issues/ExampleAdapter.java new file mode 100644 index 00000000..e567d218 --- /dev/null +++ b/SPR-9374/src/main/java/org/springframework/issues/ExampleAdapter.java @@ -0,0 +1,38 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.issues; + +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +// If @Controller is not present here, the controller won't be discovered by +// RequestMappingHandlerMapping since it is a proxy and only annotations on +// the interface are available. + +@Controller +@RequestMapping( "/example") +public interface ExampleAdapter { + + @RequestMapping( value = "/echo", method = RequestMethod.GET) + @ResponseBody + @Transactional( readOnly = true ) + public String echo(); + +} \ No newline at end of file diff --git a/SPR-9374/src/main/java/org/springframework/issues/ExampleController.java b/SPR-9374/src/main/java/org/springframework/issues/ExampleController.java new file mode 100644 index 00000000..bb20eea8 --- /dev/null +++ b/SPR-9374/src/main/java/org/springframework/issues/ExampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.issues; + +import java.util.Locale; + +import org.springframework.stereotype.Controller; + +@Controller +public class ExampleController implements ExampleAdapter { + + public String echo() { + return Long.toHexString(System.currentTimeMillis()).toUpperCase(Locale.US); + } + +} diff --git a/SPR-9374/src/main/resources/log4j.properties b/SPR-9374/src/main/resources/log4j.properties new file mode 100644 index 00000000..17a835fa --- /dev/null +++ b/SPR-9374/src/main/resources/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootCategory=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n + +log4j.category.org.springframework.web=DEBUG diff --git a/SPR-9374/src/main/webapp/WEB-INF/spring/root-context.xml b/SPR-9374/src/main/webapp/WEB-INF/spring/root-context.xml new file mode 100644 index 00000000..718584e6 --- /dev/null +++ b/SPR-9374/src/main/webapp/WEB-INF/spring/root-context.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/SPR-9374/src/main/webapp/WEB-INF/spring/servlet-context.xml b/SPR-9374/src/main/webapp/WEB-INF/spring/servlet-context.xml new file mode 100644 index 00000000..d221446f --- /dev/null +++ b/SPR-9374/src/main/webapp/WEB-INF/spring/servlet-context.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + diff --git a/SPR-9374/src/main/webapp/WEB-INF/views/home.jsp b/SPR-9374/src/main/webapp/WEB-INF/views/home.jsp new file mode 100644 index 00000000..1696c2dd --- /dev/null +++ b/SPR-9374/src/main/webapp/WEB-INF/views/home.jsp @@ -0,0 +1,11 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> + + + + +Home + + +

Home

+ + diff --git a/SPR-9374/src/main/webapp/WEB-INF/web.xml b/SPR-9374/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..b133b8a0 --- /dev/null +++ b/SPR-9374/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,36 @@ + + + + + contextConfigLocation + /WEB-INF/spring/root-context.xml + + + + org.springframework.web.context.ContextLoaderListener + + + + appServlet + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/spring/servlet-context.xml + + 1 + + + + appServlet + / + + + + + + + + diff --git a/SPR-9374/src/test/java/org/springframework/issues/.gitignore b/SPR-9374/src/test/java/org/springframework/issues/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/SPR-9374/src/test/resources/log4j.properties b/SPR-9374/src/test/resources/log4j.properties new file mode 100644 index 00000000..17a835fa --- /dev/null +++ b/SPR-9374/src/test/resources/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootCategory=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n + +log4j.category.org.springframework.web=DEBUG