@Bean
        @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
        public EntityManagerFactory samlMetadataIdPEntityManagerFactory(
            final ConfigurableApplicationContext applicationContext,
            final CasConfigurationProperties casProperties,
            @Qualifier("jpaSamlMetadataIdPVendorAdapter")
            final JpaVendorAdapter jpaSamlMetadataIdPVendorAdapter,
            @Qualifier("dataSourceSamlMetadataIdP")
            final DataSource dataSourceSamlMetadataIdP,
            @Qualifier("jpaSamlMetadataIdPPackagesToScan")
            final BeanContainer<String> jpaSamlMetadataIdPPackagesToScan,
            @Qualifier(JpaBeanFactory.DEFAULT_BEAN_NAME)
            final JpaBeanFactory jpaBeanFactory) {
            return BeanSupplier.of(EntityManagerFactory.class)
                .when(CONDITION.given(applicationContext.getEnvironment()))
                .supply(Unchecked.supplier(() -> {
                    val idp = casProperties.getAuthn().getSamlIdp().getMetadata();
                    val ctx = JpaConfigurationContext.builder()
                        .jpaVendorAdapter(jpaSamlMetadataIdPVendorAdapter)
                        .persistenceUnitName("jpaSamlMetadataIdPContext")
                        .dataSource(dataSourceSamlMetadataIdP)
                        .packagesToScan(jpaSamlMetadataIdPPackagesToScan.toSet()).build();
                    return jpaBeanFactory.newEntityManagerFactoryBean(ctx, idp.getJpa()).getObject();
                }))
                .otherwiseProxy()
                .get();
        }
This is {@link SamlIdPJpaIdPMetadataConfiguration}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-saml-idp-metadata-jpa/src/main/java/org/apereo/cas/config/SamlIdPJpaIdPMetadataConfiguration.java