mirror of
https://github.com/spring-projects/spring-security.git
synced 2026-02-09 23:14:58 +00:00
Isolate AOT Test to Security Components
PR gh-17724
This commit is contained in:
parent
a04b026000
commit
714781df78
@ -18,6 +18,8 @@ package org.springframework.security.config.annotation.method.configuration.aot;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@ -29,7 +31,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.aot.ApplicationContextAotGenerator;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
@ -72,7 +74,6 @@ public class EnableMethodSecurityAotTests {
|
||||
|
||||
@Configuration
|
||||
@EnableMethodSecurity
|
||||
@EnableJpaRepositories
|
||||
static class AppConfig {
|
||||
|
||||
@Bean
|
||||
@ -92,6 +93,14 @@ public class EnableMethodSecurityAotTests {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
JpaRepositoryFactoryBean<@NonNull MessageRepository, Message, Long> repo(EntityManager entityManager) {
|
||||
JpaRepositoryFactoryBean<@NonNull MessageRepository, Message, Long> bean = new JpaRepositoryFactoryBean<>(
|
||||
MessageRepository.class);
|
||||
bean.setEntityManager(entityManager);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user