@Bean
        @ConditionalOnMissingBean(name = "inspektrAuditEntityManagerFactory")
        @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
        public FactoryBean<EntityManagerFactory> inspektrAuditEntityManagerFactory(
            @Qualifier("jpaAuditTrailEntityFactory")
            final JpaEntityFactory<AuditTrailEntity> jpaAuditTrailEntityFactory,
            @Qualifier("inspektrAuditJpaVendorAdapter")
            final JpaVendorAdapter inspektrAuditJpaVendorAdapter,
            final ConfigurableApplicationContext applicationContext,
            @Qualifier("inspektrAuditTrailDataSource")
            final DataSource inspektrAuditTrailDataSource,
            final CasConfigurationProperties casProperties,
            @Qualifier(JpaBeanFactory.DEFAULT_BEAN_NAME)
            final JpaBeanFactory jpaBeanFactory) {
            return BeanSupplier.of(FactoryBean.class)
                .when(CONDITION.given(applicationContext.getEnvironment()))
                .supply(Unchecked.supplier(() -> {
                    val type = jpaAuditTrailEntityFactory.getType();
                    val ctx = JpaConfigurationContext
                        .builder()
                        .jpaVendorAdapter(inspektrAuditJpaVendorAdapter)
                        .persistenceUnitName("jpaInspektrAuditContext")
                        .dataSource(inspektrAuditTrailDataSource)
                        .packagesToScan(CollectionUtils.wrapSet(type.getPackage().getName()))
                        .build();
                    return jpaBeanFactory.newEntityManagerFactoryBean(ctx, casProperties.getAudit().getJdbc());
                }))
                .otherwiseProxy()
                .get();

        }
This is {@link CasJdbcAuditAutoConfiguration}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-audit-jdbc/src/main/java/org/apereo/cas/config/CasJdbcAuditAutoConfiguration.java