Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 3 Native: Fails to bind properties under 'spring.groovy.template' #33847

Closed
mmoayyed opened this issue Jan 17, 2023 · 2 comments
Closed
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@mmoayyed
Copy link
Contributor

Environment

Using Spring Boot 3.0.1 with the following:

java version "17.0.5" 2022-10-18 LTS
Java(TM) SE Runtime Environment GraalVM EE 22.3.0 (build 17.0.5+9-LTS-jvmci-22.3-b07)
Java HotSpot(TM) 64-Bit Server VM GraalVM EE 22.3.0 (build 17.0.5+9-LTS-jvmci-22.3-b07, mixed mode, sharing)

------------------------------------------------------------
Gradle 7.5
------------------------------------------------------------

Build time:   2022-07-14 12:48:15 UTC
Revision:     c7db7b958189ad2b0c1472b6fe663e6d654a5103

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.5 (Oracle Corporation 17.0.5+9-LTS-jvmci-22.3-b07)
OS:           Mac OS X 13.1 aarch64

Problem

./build/native/nativeCompile/demo

 :: Spring Boot ::                (v3.0.1)

2023-01-17T10:27:33.553+04:00  INFO 30115 --- [           main] com.example.demo.DemoApplication         : Starting AOT-processed DemoApplication using Java 17.0.5 with PID 30115 (/Users/misagh/Downloads/demo/build/native/nativeCompile/demo started by misagh in /Users/misagh/Downloads/demo)
2023-01-17T10:27:33.554+04:00  INFO 30115 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2023-01-17T10:27:33.564+04:00  INFO 30115 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-01-17T10:27:33.565+04:00  INFO 30115 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-01-17T10:27:33.565+04:00  INFO 30115 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.4]
2023-01-17T10:27:33.570+04:00  INFO 30115 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-01-17T10:27:33.570+04:00  INFO 30115 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 16 ms
2023-01-17T10:27:33.577+04:00  WARN 30115 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'welcomePageHandlerMapping': Instantiation of supplied bean failed
2023-01-17T10:27:33.577+04:00  INFO 30115 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-01-17T10:27:33.578+04:00 ERROR 30115 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'spring.groovy.template' to org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider$GroovyTemplateAvailabilityProperties:

    Reason: java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider$GroovyTemplateAvailabilityProperties.<init>()

Action:

Update your application's configuration

Steps to reproduce

  • Here is a reproducer: Archive.zip (This was initially generated using start.spring.io)
  • Unzip, and run ./gradlew clean build and then ./gradlew nativeBuild.
  • Run the generated native application

I discussed this briefly a few days ago with Brian here: https://gitter.im/spring-projects/spring-boot?at=63b67bd0fb195421bd6ceff3

If I can help with anything, particularly testing, please let me know :)

@mmoayyed
Copy link
Contributor Author

A naive (untested) solution might want to do the following:

	hints.reflection()
		.registerType(TypeReference.of("org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider$GroovyTemplateAvailabilityProperties"), 	
					MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);

...or something to that effect.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 17, 2023
@philwebb philwebb added type: bug A general bug theme: aot An issue related to Ahead-of-time processing and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 17, 2023
@philwebb philwebb added this to the 3.0.x milestone Jan 17, 2023
@mhalbritter mhalbritter self-assigned this Jan 19, 2023
@mhalbritter mhalbritter modified the milestones: 3.0.x, 3.0.2 Jan 19, 2023
@mhalbritter
Copy link
Contributor

mhalbritter commented Jan 19, 2023

FYI: Spring Boot can now bind the properties, but this won't make groovy templates work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants