Skip to content

Support for SpringBoot 3 Aot and GraalVM native images #108

@eahau

Description

@eahau

Version Info

java:17
spring-boot:3.0.1
spring-framework:6.0.3
spring-guice:2.0.2
native-maven-plugin:0.9.19

Description

I followed the requirements of the SpringBoot3 native-image document and made relevant configuration.
like this:

  <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot.version}</version>
        <configuration>
          <mainClass>${mainClass}</mainClass>
        </configuration>
        <executions>
          <execution>
            <configuration>
              <jvmArguments>
<!--                -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005-->
              </jvmArguments>

            </configuration>
            <id>process-aot</id>
            <goals>
              <goal>process-aot</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.graalvm.buildtools</groupId>
        <artifactId>native-maven-plugin</artifactId>
       <version>${native-maven-plugin.version}</version>
      </plugin>

But encountered java.lang.IllegalArgumentException: Code generation does not support com.google.inject.Key<?> when execute spring-boot-maven-plugin#process-aot
image

BeanDefinitionPropertyValueCodeGenerator#generateCode

private CodeBlock generateCode(@Nullable Object value, ResolvableType type) {
		if (value == null) {
			return NULL_VALUE_CODE_BLOCK;
		}
		for (Delegate delegate : this.delegates) {
			CodeBlock code = delegate.generateCode(value, type);
			if (code != null) {
				return code;
			}
		}
		throw new IllegalArgumentException("Code generation does not support " + type);
	}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions