Call registerSessionSerializerBeanAlias() from setImportMetadata(:AnnotationMetadata) and remove the @PostConstruct annotation. For an unknown reason, Spring Framework 6 possibly initializes Singleton beans before Spring @Configuration classes, @PostConstruct methods are invoked.