Skip to content

Commit 0e259ea

Browse files
committed
Workaround for data source cycle with hibernate
The JpaInvokerConfiguration (nested in RefreshAutoConfiguration can be removed when and if the issue is resolved in Boot. Also splits the hibernate test dependencies out into a separate module so the main context tests run quicker. Fixes gh-355
1 parent f7519a3 commit 0e259ea

File tree

18 files changed

+1327
-32
lines changed

18 files changed

+1327
-32
lines changed

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
<module>spring-cloud-commons-dependencies</module>
126126
<module>spring-cloud-test-support</module>
127127
<module>spring-cloud-context</module>
128+
<module>spring-cloud-context-integration-tests</module>
128129
<module>spring-cloud-commons</module>
129130
<module>spring-cloud-starter</module>
130131
<module>docs</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Spring Cloud Context
2+
3+
Utilities and special services for the `ApplicationContext` of a Spring Cloud application (bootstrap context, encryption, refresh scope and environment endpoints).

spring-cloud-context-integration-tests/eclipse/eclipse-code-formatter.xml

+295
Large diffs are not rendered by default.

spring-cloud-context-integration-tests/eclipse/org.eclipse.jdt.core.prefs

+389
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
cleanup.add_default_serial_version_id=true
2+
cleanup.add_generated_serial_version_id=false
3+
cleanup.add_missing_annotations=true
4+
cleanup.add_missing_deprecated_annotations=true
5+
cleanup.add_missing_methods=false
6+
cleanup.add_missing_nls_tags=false
7+
cleanup.add_missing_override_annotations=true
8+
cleanup.add_missing_override_annotations_interface_methods=true
9+
cleanup.add_serial_version_id=false
10+
cleanup.always_use_blocks=true
11+
cleanup.always_use_parentheses_in_expressions=false
12+
cleanup.always_use_this_for_non_static_field_access=true
13+
cleanup.always_use_this_for_non_static_method_access=false
14+
cleanup.convert_functional_interfaces=false
15+
cleanup.convert_to_enhanced_for_loop=false
16+
cleanup.correct_indentation=false
17+
cleanup.format_source_code=true
18+
cleanup.format_source_code_changes_only=false
19+
cleanup.insert_inferred_type_arguments=false
20+
cleanup.make_local_variable_final=false
21+
cleanup.make_parameters_final=false
22+
cleanup.make_private_fields_final=false
23+
cleanup.make_type_abstract_if_missing_method=false
24+
cleanup.make_variable_declarations_final=false
25+
cleanup.never_use_blocks=false
26+
cleanup.never_use_parentheses_in_expressions=true
27+
cleanup.organize_imports=true
28+
cleanup.qualify_static_field_accesses_with_declaring_class=false
29+
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
30+
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
31+
cleanup.qualify_static_member_accesses_with_declaring_class=true
32+
cleanup.qualify_static_method_accesses_with_declaring_class=false
33+
cleanup.remove_private_constructors=true
34+
cleanup.remove_redundant_type_arguments=true
35+
cleanup.remove_trailing_whitespaces=true
36+
cleanup.remove_trailing_whitespaces_all=true
37+
cleanup.remove_trailing_whitespaces_ignore_empty=false
38+
cleanup.remove_unnecessary_casts=true
39+
cleanup.remove_unnecessary_nls_tags=false
40+
cleanup.remove_unused_imports=true
41+
cleanup.remove_unused_local_variables=false
42+
cleanup.remove_unused_private_fields=true
43+
cleanup.remove_unused_private_members=false
44+
cleanup.remove_unused_private_methods=true
45+
cleanup.remove_unused_private_types=true
46+
cleanup.sort_members=false
47+
cleanup.sort_members_all=false
48+
cleanup.use_anonymous_class_creation=false
49+
cleanup.use_blocks=true
50+
cleanup.use_blocks_only_for_return_and_throw=false
51+
cleanup.use_lambda=true
52+
cleanup.use_parentheses_in_expressions=false
53+
cleanup.use_this_for_non_static_field_access=true
54+
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
55+
cleanup.use_this_for_non_static_method_access=false
56+
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
57+
cleanup.use_type_arguments=false
58+
cleanup_profile=_Spring Cloud Cleanup Conventions
59+
cleanup_settings_version=2
60+
eclipse.preferences.version=1
61+
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
62+
formatter_profile=_Spring Cloud Java Conventions
63+
formatter_settings_version=12
64+
org.eclipse.jdt.ui.exception.name=e
65+
org.eclipse.jdt.ui.gettersetter.use.is=false
66+
org.eclipse.jdt.ui.ignorelowercasenames=true
67+
org.eclipse.jdt.ui.importorder=java;javax;org;com;\#;
68+
org.eclipse.jdt.ui.javadoc=true
69+
org.eclipse.jdt.ui.keywordthis=false
70+
org.eclipse.jdt.ui.ondemandthreshold=9999
71+
org.eclipse.jdt.ui.overrideannotation=true
72+
org.eclipse.jdt.ui.staticondemandthreshold=9999
73+
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright 2013-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n\n${package_declaration}\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\nthrow new UnsupportedOperationException("Auto-generated method stub", ${exception_var});</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\nthrow new UnsupportedOperationException("Auto-generated method stub");</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
74+
sp_cleanup.add_default_serial_version_id=true
75+
sp_cleanup.add_generated_serial_version_id=false
76+
sp_cleanup.add_missing_annotations=true
77+
sp_cleanup.add_missing_deprecated_annotations=true
78+
sp_cleanup.add_missing_methods=false
79+
sp_cleanup.add_missing_nls_tags=false
80+
sp_cleanup.add_missing_override_annotations=true
81+
sp_cleanup.add_missing_override_annotations_interface_methods=true
82+
sp_cleanup.add_serial_version_id=false
83+
sp_cleanup.always_use_blocks=true
84+
sp_cleanup.always_use_parentheses_in_expressions=true
85+
sp_cleanup.always_use_this_for_non_static_field_access=true
86+
sp_cleanup.always_use_this_for_non_static_method_access=false
87+
sp_cleanup.convert_to_enhanced_for_loop=false
88+
sp_cleanup.correct_indentation=false
89+
sp_cleanup.format_source_code=true
90+
sp_cleanup.format_source_code_changes_only=false
91+
sp_cleanup.make_local_variable_final=false
92+
sp_cleanup.make_parameters_final=false
93+
sp_cleanup.make_private_fields_final=false
94+
sp_cleanup.make_type_abstract_if_missing_method=false
95+
sp_cleanup.make_variable_declarations_final=false
96+
sp_cleanup.never_use_blocks=false
97+
sp_cleanup.never_use_parentheses_in_expressions=false
98+
sp_cleanup.on_save_use_additional_actions=true
99+
sp_cleanup.organize_imports=true
100+
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
101+
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
102+
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
103+
sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
104+
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
105+
sp_cleanup.remove_private_constructors=true
106+
sp_cleanup.remove_trailing_whitespaces=true
107+
sp_cleanup.remove_trailing_whitespaces_all=true
108+
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
109+
sp_cleanup.remove_unnecessary_casts=true
110+
sp_cleanup.remove_unnecessary_nls_tags=false
111+
sp_cleanup.remove_unused_imports=true
112+
sp_cleanup.remove_unused_local_variables=false
113+
sp_cleanup.remove_unused_private_fields=true
114+
sp_cleanup.remove_unused_private_members=false
115+
sp_cleanup.remove_unused_private_methods=true
116+
sp_cleanup.remove_unused_private_types=true
117+
sp_cleanup.sort_members=false
118+
sp_cleanup.sort_members_all=false
119+
sp_cleanup.use_blocks=true
120+
sp_cleanup.use_blocks_only_for_return_and_throw=false
121+
sp_cleanup.use_parentheses_in_expressions=false
122+
sp_cleanup.use_this_for_non_static_field_access=true
123+
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
124+
sp_cleanup.use_this_for_non_static_method_access=false
125+
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>org.springframework.cloud</groupId>
8+
<artifactId>spring-cloud-commons-parent</artifactId>
9+
<version>2.0.0.BUILD-SNAPSHOT</version>
10+
<relativePath>..</relativePath>
11+
</parent>
12+
<artifactId>spring-cloud-context-integration-tests</artifactId>
13+
<packaging>jar</packaging>
14+
<name>spring-cloud-context-integration-tests</name>
15+
<description>Spring Cloud Context</description>
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework.cloud</groupId>
19+
<artifactId>spring-cloud-context</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.springframework.boot</groupId>
23+
<artifactId>spring-boot-starter-actuator</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-web</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-aop</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.integration</groupId>
35+
<artifactId>spring-integration-jmx</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter-test</artifactId>
40+
<scope>test</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-starter-data-jpa</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.hsqldb</groupId>
49+
<artifactId>hsqldb</artifactId>
50+
<scope>test</scope>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.cloud</groupId>
54+
<artifactId>spring-cloud-test-support</artifactId>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-configuration-processor</artifactId>
60+
<optional>true</optional>
61+
</dependency>
62+
</dependencies>
63+
<build>
64+
<plugins>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-deploy-plugin</artifactId>
68+
<configuration>
69+
<skip>true</skip>
70+
</configuration>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2016-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+
17+
package org.springframework.cloud.autoconfigure;
18+
19+
import org.junit.Test;
20+
21+
import org.springframework.boot.SpringBootConfiguration;
22+
import org.springframework.boot.WebApplicationType;
23+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
24+
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
25+
import org.springframework.boot.builder.SpringApplicationBuilder;
26+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
27+
import org.springframework.context.annotation.Import;
28+
29+
/**
30+
* @author Dave Syer
31+
*
32+
*/
33+
public class JdbcConfigurationTests {
34+
35+
@Test
36+
public void schemaApplied() {
37+
new SpringApplicationBuilder(BrokenApplication.class).web(WebApplicationType.NONE)
38+
.run("--spring.datasource.initialization-mode=always").close();
39+
}
40+
41+
@SpringBootConfiguration
42+
@EnableConfigurationProperties(DataSourceProperties.class)
43+
@Import({ DataSourceAutoConfiguration.class, RefreshAutoConfiguration.class })
44+
protected static class BrokenApplication {
45+
46+
public static void main(String[] args) {
47+
new SpringApplicationBuilder(BrokenApplication.class)
48+
.web(WebApplicationType.NONE).run(args);
49+
}
50+
51+
}
52+
53+
}

0 commit comments

Comments
 (0)