diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java index 7c762498d1..a5c316972b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java @@ -114,16 +114,6 @@ public class OAuth2RestOperationsConfiguration { @ConditionalOnWebApplication protected static class SessionScopedConfiguration extends BaseConfiguration { - @Resource - @Qualifier("accessTokenRequest") - protected AccessTokenRequest accessTokenRequest; - - @Bean - @Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES) - public DefaultOAuth2ClientContext oauth2ClientContext() { - return new DefaultOAuth2ClientContext(this.accessTokenRequest); - } - @Bean public FilterRegistrationBean oauth2ClientFilterRegistration( OAuth2ClientContextFilter filter) { @@ -133,6 +123,21 @@ public class OAuth2RestOperationsConfiguration { return registration; } + @Configuration + protected static class ClientContextConfiguration { + + @Resource + @Qualifier("accessTokenRequest") + protected AccessTokenRequest accessTokenRequest; + + @Bean + @Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES) + public DefaultOAuth2ClientContext oauth2ClientContext() { + return new DefaultOAuth2ClientContext(this.accessTokenRequest); + } + + } + } /* diff --git a/spring-boot-deployment-tests/pom.xml b/spring-boot-deployment-tests/pom.xml index 4051933721..750ec818de 100644 --- a/spring-boot-deployment-tests/pom.xml +++ b/spring-boot-deployment-tests/pom.xml @@ -23,8 +23,9 @@ ${java.io.tmpdir}/cargo/installs - spring-boot-deployment-test-tomee + spring-boot-deployment-test-glassfish spring-boot-deployment-test-tomcat + spring-boot-deployment-test-tomee spring-boot-deployment-test-wildfly diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml new file mode 100644 index 0000000000..4097b4a99f --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-deployment-tests + 1.3.0.BUILD-SNAPSHOT + + spring-boot-deployment-test-glassfish + war + Spring Boot Glassfish Deployment Test + Spring Boot Glassfish Deployment Test + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + 4.1.1 + glassfish4x + http://download.oracle.com/glassfish/${glassfish.version}/release/glassfish-${glassfish.version}.zip + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + javax.servlet + javax.servlet-api + provided + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + reserve-network-port + + reserve-network-port + + process-resources + + + appserver.port + appserver.admin.port + appserver.jms.port + appserver.iiop.port + appserver.https.port + appserver.iiops.port + appserver.iiopmutualauth.port + appserver.jmx.port + appserver.osgishell.port + appserver.debugger.port + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + + + + ${appserver.port} + ${appserver.admin.port} + ${appserver.jmx.port} + ${appserver.https.port} + ${appserver.debugger.port} + ${appserver.jms.port} + ${appserver.iiop.port} + ${appserver.iiopmutualauth.port} + ${appserver.iiops.port} + ${appserver.osgishell.port} + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + ${appserver.port} + + + + + + diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleController.java b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleController.java new file mode 100644 index 0000000000..cef966424d --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2015 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 sample; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SampleController { + + @RequestMapping("/") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleGlassfishDeployApplication.java b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleGlassfishDeployApplication.java new file mode 100644 index 0000000000..d73fe8a162 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/main/java/sample/SampleGlassfishDeployApplication.java @@ -0,0 +1,25 @@ +/* + * Copyright 2012-2015 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 sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.web.SpringBootServletInitializer; + +@SpringBootApplication +public class SampleGlassfishDeployApplication extends SpringBootServletInitializer { + +} diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java new file mode 100644 index 0000000000..ceb681fe08 --- /dev/null +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012-2015 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 sample; + +import org.junit.Test; + +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import static org.junit.Assert.assertEquals; + +/** + * Integration Tests for {@link SampleGlassfishDeployApplication}. + */ +public class SampleGlassfishDeployApplicationIT { + + private int port = Integer.valueOf(System.getProperty("port")); + + @Test + public void testHome() throws Exception { + String url = "http://localhost:" + this.port + "/bootapp/"; + System.out.println(url); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, + String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertEquals("Hello World", entity.getBody()); + } + +} diff --git a/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java new file mode 100644 index 0000000000..41091ebf97 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-devtools/src/test/java/sample/devtools/SampleDevToolsApplicationIntegrationTests.java @@ -0,0 +1,26 @@ +/* + * Copyright 2012-2015 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 sample.devtools; + +/** + * Integration tests for {@link SampleDevToolsApplication}. + * + * @author Andy Wilkinson + */ +public class SampleDevToolsApplicationIntegrationTests { + +}