question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoconfiguration not working in Spring boot 3.0.0-RC2

See original GitHub issue

Hello,

When I follow your instructions for Maven and Spring Boot to configure the environment, I get a lot of exceptions when the server starts.

I have had to manually copy GraphQlDateTimeAutoConfiguration, GraphQlDateTimeProperties and GraphQlDateTimeScalarsAutoConfiguration to my project, and then it works. For any reason, your autoconfiguration seems to not be working with Spring boot 3.0.0-RC2. I am also using Java 19 (just in case it could be also related to the issue).

Find some exceptions examples here:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerFunctionMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Error creating bean with name 'graphQlRouterFunction' defined in class path resource [org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQlRouterFunction' parameter 0: Error creating bean with name 'graphQlHttpHandler' defined in class path resource [org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQlHttpHandler' parameter 0: Error creating bean with name 'webGraphQlHandler' defined in class path resource [org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webGraphQlHandler' parameter 0: Error creating bean with name 'executionGraphQlService' defined in class path resource [org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.class]: Unsatisfied dependency expressed through method 'executionGraphQlService' parameter 0: Error creating bean with name 'graphQlSource' defined in class path resource [org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.class]: Failed to instantiate [org.springframework.graphql.execution.GraphQlSource]: Factory method 'graphQlSource' threw exception with message: errors=[There is no scalar implementation for the named  'Date' scalar type, There is no scalar implementation for the named  'LocalDate' scalar type, There is no scalar implementation for the named  'LocalDateTime' scalar type, There is no scalar implementation for the named  'LocalTime' scalar type, There is no scalar implementation for the named  'OffsetDateTime' scalar type, There is no scalar implementation for the named  'YearMonth' scalar type, There is no scalar implementation for the named  'Duration' scalar type]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1753) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]

...

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.graphql.execution.GraphQlSource]: Factory method 'graphQlSource' threw exception with message: errors=[There is no scalar implementation for the named  'Date' scalar type, There is no scalar implementation for the named  'LocalDate' scalar type, There is no scalar implementation for the named  'LocalDateTime' scalar type, There is no scalar implementation for the named  'LocalTime' scalar type, There is no scalar implementation for the named  'OffsetDateTime' scalar type, There is no scalar implementation for the named  'YearMonth' scalar type, There is no scalar implementation for the named  'Duration' scalar type]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]
	... 86 common frames omitted
Caused by: graphql.schema.idl.errors.SchemaProblem: errors=[There is no scalar implementation for the named  'Date' scalar type, There is no scalar implementation for the named  'LocalDate' scalar type, There is no scalar implementation for the named  'LocalDateTime' scalar type, There is no scalar implementation for the named  'LocalTime' scalar type, There is no scalar implementation for the named  'OffsetDateTime' scalar type, There is no scalar implementation for the named  'YearMonth' scalar type, There is no scalar implementation for the named  'Duration' scalar type]
	at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:82) ~[graphql-java-19.2.jar:na]
	at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:58) ~[graphql-java-19.2.jar:na]
	at org.springframework.graphql.execution.DefaultSchemaResourceGraphQlSourceBuilder.initGraphQlSchema(DefaultSchemaResourceGraphQlSourceBuilder.java:112) ~[spring-graphql-1.1.0-RC1.jar:1.1.0-RC1]
	at org.springframework.graphql.execution.AbstractGraphQlSourceBuilder.build(AbstractGraphQlSourceBuilder.java:93) ~[spring-graphql-1.1.0-RC1.jar:1.1.0-RC1]
	at org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration.graphQlSource(GraphQlAutoConfiguration.java:94) ~[spring-boot-autoconfigure-3.0.0-RC2.jar:3.0.0-RC2]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ~[spring-beans-6.0.0-RC4.jar:6.0.0-RC4]

...

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
donbeavecommented, Nov 30, 2022

I will release a new major version this week which will support the Spring Boot 3.0.

1reaction
victorfunescommented, Nov 30, 2022

Thank you! It works perfectly well now. Just to add a little detail to your answer: the full filename I have used has the extension “imports”. ${YOUR_PROJECT}/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Reference Documentation
Many Spring Boot developers like their apps to use auto-configuration, component scan and be able to define extra configuration on their "application class"....
Read more >
Spring Boot 3.0 Release Notes - GitHub
Auto-configuration for Micrometer Observation API. Spring Boot 3.0 supports the new observation APIs introduced in Micrometer 1.10.
Read more >
Custom springboot autoconfiguration not detecting beans
Native spring boot autoconfigurations (such as DataSource one) can instead detect beans declared in the main class too (such as a @Bean ...
Read more >
spring-cloud-gcp-autoconfigure : 2.0.0-RC2 - Maven Central
Spring Cloud GCP Module - Autoconfigure - Spring Cloud GCP. ... com.google.cloud:spring-cloud-gcp-autoconfigure 2.0.0-RC2. content_copy.
Read more >
Announcing the beta release of Spring Cloud Azure versions ...
The 6.0.0 Beta3 release upgrades Spring Boot dependencies version to ... to 3.0.0-RC2 and Spring Cloud dependencies version to 2022.0.0-RC2 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found