Buggy code:
@ Slf4j @ RequiredArgsConstructor public class ApiResourcesPostProcessor implements BeanDefinitionRegistryPostProcessor , InitializingBean , PriorityOrdered { private final String basePackage ; private Set < Class < ? > > entities ; private Map < Class < ? > , ApiResourcesPostProcessor . BeanDefinitionDetails > map = new HashMap < Class < ? > , ApiResourcesPostProcessor . BeanDefinitionDetails > ( ) ; @ Override public void postProcessBeanDefinitionRegistry ( BeanDefinitionRegistry registry ) throws BeansException { } private void generateHelpers ( BeanDefinitionRegistry registry ) { } public void generateBeans ( BeanDefinitionRegistry registry ) throws CannotCompileException , NotFoundException { } private void generateBeansForEntity ( BeanDefinitionRegistry registry , Class < ? > entity ) throws CannotCompileException , NotFoundException { ApiResourceMapping mapping = ApiResourceUtil . from ( entity ) ; ApiResourcesPostProcessor . BeanDefinitionDetails details = map . get ( entity ) ; if ( ( details . service ) == null ) { String component = "Service" ; String name = ( entity . getSimpleName ( ) ) + component ; Class < ? > abstractClass = ApiResourceServiceImpl . class ; Class < ? > serviceClass = JavassistUtil . generateTypedSubclass ( name , abstractClass , mapping . idClass ( ) , mapping . domainClass ( ) , mapping . createBeanClass ( ) , mapping . readBeanClass ( ) , mapping . updateBeanClass ( ) ) ; AbstractBeanDefinition def = BeanDefinitionBuilder . rootBeanDefinition ( serviceClass ) . addConstructorArgValue ( mapping ) . getBeanDefinition ( ) ; registry . registerBeanDefinition ( name , def ) ; details . service = def ; log . info ( "Generated<seq2seq4repair_space>{}<seq2seq4repair_space>for<seq2seq4repair_space>{}.<seq2seq4repair_space>Generic<seq2seq4repair_space>signature:<seq2seq4repair_space>{}" , component , entity . getSimpleName ( ) , GenericTypeResolver . resolveTypeArguments ( serviceClass , abstractClass ) ) ; } else { log . info ( "Found<seq2seq4repair_space>service<seq2seq4repair_space>for<seq2seq4repair_space>{}" , entity . getSimpleName ( ) ) ; } if ( ( details . repository ) == null ) { String component = "Repository" ; String name = ( entity . getSimpleName ( ) ) + component ; Class < ? > abstractClass = ApiResourceRepository . class ; Class < ? > serviceClass = JavassistUtil . generateTypedInterface ( name , abstractClass , mapping . idClass ( ) , mapping . domainClass ( ) ) ; AbstractBeanDefinition def = BeanDefinitionBuilder . rootBeanDefinition ( JpaRepositoryFactoryBean . class ) . addPropertyValue ( "repositoryInterface" , serviceClass ) . getBeanDefinition ( ) ; registry . registerBeanDefinition ( ( ( entity . getSimpleName ( ) ) + "Repository" ) , def ) ; details . repository = def ; log . info ( "Generated<seq2seq4repair_space>{}<seq2seq4repair_space>for<seq2seq4repair_space>{}.<seq2seq4repair_space>Generic<seq2seq4repair_space>signature:<seq2seq4repair_space>{}" , component , entity . getSimpleName ( ) , GenericTypeResolver . resolveTypeArguments ( serviceClass , abstractClass ) ) ; } else { log . info ( "Found<seq2seq4repair_space>repository<seq2seq4repair_space>for<seq2seq4repair_space>{}" , entity . getSimpleName ( ) ) ; } if ( ( details . controller ) == null ) { if ( mapping . omitController ( ) ) { log . info ( "Ignored<seq2seq4repair_space>controller<seq2seq4repair_space>for<seq2seq4repair_space>{}" , entity . getSimpleName ( ) ) ; } else { String component = "Controller" ; String name = ( entity . getSimpleName ( ) ) + component ; Class < ? > abstractClass = ApiResourceController . class ; Class < ? > serviceClass = JavassistUtil . generateTypedSubclass ( name , abstractClass , mapping . idClass ( ) , mapping . domainClass ( ) , mapping . createBeanClass ( ) , mapping . readBeanClass ( ) , mapping . updateBeanClass ( ) ) ; AbstractBeanDefinition def = BeanDefinitionBuilder . rootBeanDefinition ( serviceClass ) . addConstructorArgValue ( mapping ) . getBeanDefinition ( ) ; registry . registerBeanDefinition ( name , def ) ; details . controller = def ; log . info ( "Generated<seq2seq4repair_space>{}<seq2seq4repair_space>for<seq2seq4repair_space>{}.<seq2seq4repair_space>Generic<seq2seq4repair_space>signature:<seq2seq4repair_space>{}" , component , entity . getSimpleName ( ) , GenericTypeResolver . resolveTypeArguments ( serviceClass , abstractClass ) ) ; } } else { log . info ( "Found<seq2seq4repair_space>controller<seq2seq4repair_space>for<seq2seq4repair_space>{}" , entity . getSimpleName ( ) ) ; String name = ( entity . getSimpleName ( ) ) + "Controller" ; registry . registerBeanDefinition ( name , details . controller ) ; } if ( ( details . assembler ) == null ) { String component = "Assembler" ; String name = ( entity . getSimpleName ( ) ) + component ; Class < ? > abstractClass = ApiResourceAssembler . class ; Collection < Class < ? > > ifaces = new ArrayList < > ( ) ; ifaces . add ( IApiResourceAssembler . class ) ; <START_BUG> Class < ? > serviceClass = JavassistUtil . generateTypedSubclass ( name , abstractClass , ifaces , mapping . idClass ( ) , mapping . domainClass ( ) , mapping . createBeanClass ( ) , mapping . readBeanClass ( ) , mapping . updateBeanClass ( ) ) ; <END_BUG> AbstractBeanDefinition def = BeanDefinitionBuilder . rootBeanDefinition ( serviceClass ) . addPropertyValue ( "mapping" , mapping ) . getBeanDefinition ( ) ; registry . registerBeanDefinition ( name , def ) ; details . assembler = def ; log . info ( "Generated<seq2seq4repair_space>{}<seq2seq4repair_space>for<seq2seq4repair_space>{}.<seq2seq4repair_space>Generic<seq2seq4repair_space>signature:<seq2seq4repair_space>{}" , component , entity . getSimpleName ( ) , GenericTypeResolver . resolveTypeArguments ( serviceClass , abstractClass ) ) ; } else { log . info ( "Found<seq2seq4repair_space>assembler<seq2seq4repair_space>for<seq2seq4repair_space>{}" , entity . getSimpleName ( ) ) ; } } @ SneakyThrows public void populateMap ( BeanDefinitionRegistry registry ) { } @ SneakyThrows private boolean isBeanType ( AbstractBeanDefinition beanDef , Class < ? > targetType ) { } @ SneakyThrows private Class < ? > getEntityType ( AbstractBeanDefinition def , Class < ? > gen ) { } @ Override public void postProcessBeanFactory ( ConfigurableListableBeanFactory bf ) throws BeansException { } @ Override public void afterPropertiesSet ( ) throws Exception { } @ Override public int getOrder ( ) { } class BeanDefinitionDetails { AbstractBeanDefinition repository ; AbstractBeanDefinition service ; AbstractBeanDefinition controller ; AbstractBeanDefinition assembler ; } }

Fix:
Class < ? > serviceClass = JavassistUtil . generateTypedSubclass ( name , abstractClass , mapping . idClass ( ) , mapping . domainClass ( ) , mapping . createBeanClass ( ) , mapping . readBeanClass ( ) , mapping . updateBeanClass ( ) ) ;