Permalink
Browse files

Prove that SPR-9035 works as advertised

See diff and instructions within. Setting spring.profiles.active as
an init-param against the DispatcherServlet applies only to the child
application context, not to the root.
  • Loading branch information...
1 parent a0a909e commit 5c1262bf736b4ea7393b6afd159bb3a0a40bb1b1 @cbeams cbeams committed Feb 4, 2012
View
21 SPR-9035/src/main/java/com/acme/Bar.java
@@ -0,0 +1,21 @@
+/*
+ * 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 com.acme;
+
+public class Bar {
+
+}
View
21 SPR-9035/src/main/java/com/acme/Foo.java
@@ -0,0 +1,21 @@
+/*
+ * 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 com.acme;
+
+public class Foo {
+ public Foo(Bar bar) { }
+}
View
9 SPR-9035/src/main/webapp/WEB-INF/spring/servlet-context.xml
@@ -19,4 +19,13 @@
<context:component-scan base-package="org.springframework.web.issues" />
+ <!-- wiring for this bean will fail if the PRODUCKSEAN profile is not activated -->
+ <bean id="foo" class="com.acme.Foo">
+ <constructor-arg ref="bar"/>
+ </bean>
+
+ <beans profile="PRODUCKSEAN">
+ <bean id="bar" class="com.acme.Bar"/>
+ </beans>
+
</beans>
View
5 SPR-9035/src/main/webapp/WEB-INF/web.xml
@@ -19,6 +19,11 @@
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/servlet-context.xml</param-value>
</init-param>
+ <!-- comment out the following and wiring for servlet-context.xml will fail -->
+ <init-param>
+ <param-name>spring.profiles.active</param-name>
+ <param-value>PRODUCKSEAN</param-value>
+ </init-param>
<load-on-startup>1</load-on-startup>
</servlet>

0 comments on commit 5c1262b

Please sign in to comment.