some of the types that are serialized in the session should also be registered as serializable in graalvm aot hints

Author: joshlongCreated Sep 29, 2026Updated Sep 29, 2026
Labelsstatus: waiting-for-triagetype: bug

i mention this because spring session serialzizes the contents of the session to a backing database store and spring security routinely puts objects in the sesion

here are some aot hints i had to register on a spring cloud gateway + oauth client app

java


	static class Hints implements RuntimeHintsRegistrar {

		@Override
		public void registerHints(@NonNull RuntimeHints hints, @Nullable ClassLoader classLoader) {

			for (var c : new String[] { "java.time.Ser", "java.util.Collections$UnmodifiableMap" }) {
				hints.reflection().registerType(TypeReference.of(c), th -> th.withJavaSerialization(true));
			}

			for (var c : new Class[] { URL.class, URI.class, AuthorizationGrantType.class,
					OAuth2AuthorizationResponseType.class, OidcIdToken.class, Instant.class, AddressStandardClaim.class,
					OidcUserInfo.class, OidcUserAuthority.class, OAuth2UserAuthority.class, LinkedHashSet.class,
					HashSet.class, LinkedHashMap.class, OAuth2AuthorizationRequest.class, AbstractOAuth2Token.class,
					DefaultOAuth2User.class, Jwt.class, OAuth2AccessToken.class, OAuth2DeviceCode.class,
					OAuth2RefreshToken.class, OAuth2UserCode.class, OidcIdToken.class, OidcLogoutToken.class,
					DefaultOidcUser.class })
				hints.reflection().registerType(c, th -> th.withJavaSerialization(true));

		}

	}

Source: spring-projects/spring-security