HTTP 상태 500 – 내부 서버 오류

서블릿 [appServlet]을(를) 위한 Servlet.init() 호출이 예외를 발생시켰습니다.
이 에러가 뜨고 말았습니다 ㅠㅠ

에러 세부 내용이
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource' defined in class path resource [example/spmvc/lab11/AppConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.context.MessageSource example.spmvc.lab11.AppConfig.messageSource()] threw exception; nested exception is java.lang.NoSuchMethodError: 'void org.springframework.context.support.ResourceBundleMessageSource.setDefaultEncoding(java.lang.String)'

이건데


대충 빈 생성 오류라는거같은데 이걸 어떻게 해야되는건지를 모르겠습니다...



여기가 에러난 부분 인거 같은데 어떻게 해야될까요...


package example.spmvc.lab11;


import org.springframework.context.MessageSource;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.context.support.ResourceBundleMessageSource;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration

public class AppConfig implements WebMvcConfigurer {

// 빈 이름은 무조건 messageSource 여야 함 !!

@Bean

public MessageSource messageSource() {

// 메시지 파일로 프로퍼티 형식 사용을 위한 MessageSource 구현체 클래스

    ResourceBundleMessageSource ms = new ResourceBundleMessageSource();

ms.setBasenames("label"); // src/main/resources 폴더에label.properties가 있기 때문

ms.setDefaultEncoding("UTF-8");

return ms;

}

}