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

Commit 529f2f3

Browse files
committed
Enable graphql tools properties
1 parent 6c906c6 commit 529f2f3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

graphql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphql/boot/ClasspathResourceSchemaStringProvider.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ public class ClasspathResourceSchemaStringProvider implements SchemaStringProvid
1717

1818
@Autowired
1919
private ApplicationContext applicationContext;
20-
@Autowired
21-
private GraphQLToolsProperties props;
20+
private String schemaLocationPattern;
21+
22+
public ClasspathResourceSchemaStringProvider(String schemaLocationPattern) {
23+
this.schemaLocationPattern = schemaLocationPattern;
24+
}
2225

2326
@Override
2427
public List<String> schemaStrings() throws IOException {
25-
Resource[] resources = applicationContext.getResources("classpath*:" + props.getSchemaLocationPattern());
28+
Resource[] resources = applicationContext.getResources("classpath*:" + schemaLocationPattern);
2629
if (resources.length <= 0) {
2730
throw new IllegalStateException(
2831
"No graphql schema files found on classpath with location pattern '"
29-
+ props.getSchemaLocationPattern()
32+
+ schemaLocationPattern
3033
+ "'. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context.");
3134
}
3235

graphql-spring-boot-autoconfigure/src/main/java/com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
@Configuration
3030
@ConditionalOnClass(SchemaParser.class)
3131
@AutoConfigureAfter({JacksonAutoConfiguration.class})
32-
@EnableConfigurationProperties({GraphQLToolsProperties.class})
3332
public class GraphQLJavaToolsAutoConfiguration {
3433

3534
@Autowired(required = false)
@@ -47,7 +46,7 @@ public class GraphQLJavaToolsAutoConfiguration {
4746
@Bean
4847
@ConditionalOnMissingBean
4948
public SchemaStringProvider schemaStringProvider() {
50-
return new ClasspathResourceSchemaStringProvider();
49+
return new ClasspathResourceSchemaStringProvider(props.getSchemaLocationPattern());
5150
}
5251

5352
@Bean

0 commit comments

Comments
 (0)