sts 에서 bean 에러 발생시 > 질문답변

본문 바로가기

사이트 내 전체검색

뒤로가기 질문답변

sts 에서 bean 에러 발생시

페이지 정보

작성자 미친새 작성일 26-11-25 15:45 조회 2 댓글 0

본문

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 1 of method productJob in com.example.batchmybatis.config.ProductJobConfig required a single bean, but 2 were found:
- insertProductStep: defined by method 'insertProductStep' in class path resource [com/example/batchmybatis/config/ProductJobConfig.class]
- updateProductStep: defined by method 'updateProductStep' in class path resource [com/example/batchmybatis/config/ProductJobConfig.class]

This may be due to missing parameter name information

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

Ensure that your compiler is configured to use the '-parameters' flag.
You may need to update both your build tool settings as well as your IDE.
(See https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.1-Release-Notes#parameter-name-retention)

소스 바꾼거 없고 자바 버전만 바꿨는데 오류나면 실행 자바와 gradle 연동 버전이 잘못된거
properties  환경설정 가서 gradle -> override workspace settings (체크)-> advanced options 에 java home 을 바뀐 자바 위치로 변경.



보통 Spring(특히 Spring 6.x / Spring Boot 3.x 이상)에서 파라미터 이름을 인식하지 못할 때(-parameters 컴파일러 옵션 누락 등) 뜨는 안내 문구입니다. 빌드 도구(Gradle/Maven)와 STS(Eclipse 기반 IDE) 양쪽 모두에 옵션을 반영해야 합니다.

1. 빌드 도구 설정 업데이트


Gradle (build.gradle)

java 컴파일 태스크에 -parameters 옵션을 추가합니다.
groovy
tasks.withType(JavaCompile) {
    options.compilerArgs << '-parameters'
}


 STS IDE 설정 업데이트

빌드 도구만 수정하면 STS 내부 컴파일러에는 바로 적용되지 않을 수 있습니다.
1. 프로젝트 우클릭 → Properties 진입
2. Java Compiler 선택
3. Store information about method parameters (usable via reflection) 항목 체크
4. Apply and Close 클릭
5. 상단 메뉴 Project → Clean... 실행 후 프로젝트 선택하여 클린 빌드

댓글목록 0

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

PC 버전으로 보기