config/src/main/java/org/springframework/security/config/crypto/RsaKeyConversionServicePostProcessor.java
@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		if (hasUserDefinedConversionService(beanFactory)) {
			return;
		}

		Converter<String, RSAPrivateKey> pkcs8 = pkcs8();
		Converter<String, RSAPublicKey> x509 = x509();

		ConversionService service = beanFactory.getConversionService();
		if (service instanceof ConverterRegistry) {
			ConverterRegistry registry = (ConverterRegistry) service;
			registry.addConverter(String.class, RSAPrivateKey.class, pkcs8);
			registry.addConverter(String.class, RSAPublicKey.class, x509);
		} else {
			beanFactory.addPropertyEditorRegistrar(registry -> {
				registry.registerCustomEditor(RSAPublicKey.class, new ConverterPropertyEditorAdapter<>(x509));
				registry.registerCustomEditor(RSAPrivateKey.class, new ConverterPropertyEditorAdapter<>(pkcs8));
			});
		}
	}
@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		if (hasUserDefinedConversionService(beanFactory)) {
			return;
		}

		Converter<String, RSAPrivateKey> pkcs8 = pkcs8();
		Converter<String, RSAPublicKey> x509 = x509();

		ConversionService service = beanFactory.getConversionService();
		if (service instanceof ConverterRegistry) {
			ConverterRegistry registry = (ConverterRegistry) service;
			registry.addConverter(String.class, RSAPrivateKey.class, pkcs8);
			registry.addConverter(String.class, RSAPublicKey.class, x509);
		} else {
			beanFactory.addPropertyEditorRegistrar(registry -> {
				registry.registerCustomEditor(RSAPublicKey.class, new ConverterPropertyEditorAdapter<>(x509));
				registry.registerCustomEditor(RSAPrivateKey.class, new ConverterPropertyEditorAdapter<>(pkcs8));
			});
		}
	}
@ Override public void postProcessBeanFactory ( ConfigurableListableBeanFactory beanFactory ) throws BeansException { if ( hasUserDefinedConversionService ( beanFactory ) ) { return ; } Converter < String , RSAPrivateKey > pkcs8 = pkcs8 ( ) ; Converter < String , RSAPublicKey > x509 = x509 ( ) ; ConversionService service = beanFactory . getConversionService ( ) ; if ( service instanceof ConverterRegistry ) { ConverterRegistry registry = ( ConverterRegistry ) service ; registry . addConverter ( String . class , RSAPrivateKey . class , pkcs8 ) ; registry . addConverter ( String . class , RSAPublicKey . class , x509 ) ; } else { beanFactory . addPropertyEditorRegistrar ( registry -> { registry . registerCustomEditor ( RSAPublicKey . class , new ConverterPropertyEditorAdapter <> ( x509 ) ) ; registry . registerCustomEditor ( RSAPrivateKey . class , new ConverterPropertyEditorAdapter <> ( pkcs8 ) ) ; } ) ; } }
{@inheritDoc}
{