1. Java - Mysql 연동 문제
에러 종류 : java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
에러 이유 & 해결 방법
1. 입력문제
에러 이유 : application.properties에 적힌 mysql user의 아이디와 비밀번호가 잘못 입력되있다.
(필자는 여기에 해당했음 - 띄워쓰기가 되어있어서 에러뜸;;)
해결 방법 : 아이디 비밀번호를 알맞게 수정하면 끝!
2. 권한이 없을 때
해결방법 :
GRANT ALL PRIVILEGES ON *.*TO 'user_id'@'%' IDENTIFIED BY 'user_password' with GRANT OPTION;
FLUSH PRIVILEGES;
위의 것에 user_id에 아이디를, 'user_password'에는 비밀번호를 입력한다. (따옴표도 같이 입력해줘야 함)
3. 그래도 안된다! (이유 불명)
create user {username}@{ip} identified by '{password}';
위의 것처럼 다시 유저를 입력하고 권한을 준다.
2. Spring Bean 중복에러
org.springframework.context.annotation.ConflictingBeanDefinitionException:
Annotation-specified bean name 'testMapper' for bean class [com.xxx.v2.mapper.testMapper] conflicts
with existing, non-compatible bean definition of same name and class [com.xxx.v1.mapper.testMapper]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate
에러 코드를 잘 읽어보면 testMapper라는 Bean이 중복되었다는 뜻이다.
그럴때는 파일들을 잘 살펴보면서 중복된 testMapper를 삭제해주면 된다.
v1, v2로 나눠서 하는 경우라서 어쩔 수 없이 삭제가 불가능한 경우에는 아래 블로그 참조
스프링부트 파일명(Class명) 중복시 Bean 중복등록 에러 (BeanNameGenerator 사용)
Bean Same name 오류발생 ! 빈 이름이 같아서 에러난다는거쥬? API 버전 v1에서 v2로 새로 생성하면서...
blog.naver.com
3. JpaAuditing 선언 오류
The bean 'jpaAuditingHandler' could not be registered.
A bean with that name has already been defined and overriding is disabled.
Application에 @EnableJpaAuditing이 선언되어 있을 텐데, 이걸 주석처리하거나, Configuration에 있는 @EnableJpaAuditing을 주석처리하자
참고 :
https://velog.io/@1984/MySQL%EC%9D%98-%EC%97%B0%EB%8F%99-%EC%98%A4%EB%A5%98-java.sql.SQLException
https://kimji0139.tistory.com/36