2014-12-17 3 views
0

내장 된 h2 데이터베이스와 함께 Spring Boot 1.2.0을 사용하고 있습니다. 데이터베이스는 클래스 경로의 schema.sql 파일을 사용하여 초기화됩니다. @EnableGlobalMethodSecurity 주석을 WebSecurityConfiguration 클래스에 추가 할 때까지 제대로 작동했습니다.DataSourceInitializer : ApplicationEventMulticaster가 초기화되지 않았습니다.

java.lang.IllegalStateException : ApplicationEventMulticaster와는 예외가 문제가 될 수 무엇 DataSourceInitializer.runSchemaScripts

에서 발생합니다 초기화되지?

@Configuration 
@ComponentScan 
@EnableAutoConfiguration 
public class Application { 

    public static void main(String[] args) { 
     SpringApplication.run(Application.class, args); 
    } 
} 

@EnableGlobalMethodSecurity(securedEnabled = true) 
@Configuration 
class WebSecurityConfiguration extends GlobalAuthenticationConfigurerAdapter { 

    @Autowired 
    DataSource dataSource; 

    @Override 
    public void init(AuthenticationManagerBuilder auth) throws Exception { 
     auth.jdbcAuthentication().dataSource(dataSource); 
    } 
} 
+0

[# 1711] (https://github.com/spring-projects/spring-boot/issues/1711)와 유사합니다. 'WebSecurityConfiguration'은 당신의 주요'Application'과 다른 클래스입니다, 맞습니까? –

+0

'WebSecurityConfiguration'이 다른 클래스에 있습니다. 나는 또한 그것을 메인 어플리케이션의 내부 클래스로 만들려고 노력했다. 그러나 나는 같은 예외를 얻고있다. – leon01

답변

0

내가 솔루션이 설치 JDBC 인증에 init 방법을 사용하지 않는 것입니다 생각 : 여기

는 코드입니다. GlobalAuthenticationConfigurerAdapter을 확장하는 별도의 클래스로 시도하고 config 메서드를 재정의하십시오.

+0

JDBC 인증 설정을'configure' 메소드로 옮겼지만 동일한 예외가 발생했습니다. – leon01

+0

어떤 설정 방법입니까? –

+0

문제는 [1386] (https://github.com/spring-projects/spring-boot/issues/1386)과 같습니다. 그래서 DML을 schema.sql로 옮겼습니다. – leon01

관련 문제