2014-10-05 2 views
1

봄 4.1.1을 사용하여 이상한 동작이 발생합니다.이 오류가 발생합니다.AnnotationConfigRegistry가 스프링 4에 없습니다.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project newvalia-view: Compilation failure 
[ERROR] /C:/Users/edu/IdeaProjects/newvalia/newvalia- view/src/main/java/com/newvalia/web/init/WebInitContext.java:[19,12] cannot access org.springframework.context.annotation.AnnotationConfigRegistry 
[ERROR] class file for org.springframework.context.annotation.AnnotationConfigRegistry not found 

봄 4.0.7로 다운 그레이드하면 제대로 컴파일됩니다.

@Configuration 
@ComponentScan(value = "com.newvalia.web") 
@EnableWebMvc 
public class WebMvcConfig extends WebMvcConfigurerAdapter { 
} 

public class WebInitContext implements WebApplicationInitializer { 
@Override 
public void onStartup(ServletContext container) { 
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); 
    ctx.register(WebMvcConfig.class); 

    ctx.setServletContext(container); 

    Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx)); 
    servlet.addMapping("/"); 
    servlet.setLoadOnStartup(1); 

} 

이 새로운 예상되는 동작입니다 : 나는 간단한 스프링 webmwc 구성을 사용하고?

+0

org.springframework.context jar 파일을 가져 오시겠습니까? –

+0

예, 방금 봄잠을 바꾸고 있습니다. 그게 전부 야 . – duardito

+0

오 세상에, 나는 봄의 컨텍스트가있는 harcoded jar를 가리키고 있었고, 대신에 pom의 전역 속성을 가리켰다. – duardito

답변

2

import org.springframework.context jar이 pom 파일에 올바르게 있습니다. thats입니다.

희망이 도움이됩니다.

관련 문제