Spring
[Spring] 오류정리
ssooyn_n
2022. 4. 17. 20:48
1. DataSource에 @Bean표시를 해주지 않을 때, 일어나는 오류

No qualifying bean of type 'javax.sql.DataSource' 오류 해결방법
Appliconfig.java 파일에 있는 DataSource메소드에 @Bean표시를 해준다.

2. RepoImple에 @Repository를 선언해 주지 않았을 때 일어나는 오류

3. ServiceImple에 @Service를 선언해 주지 않았을 때 일어나는 오류

4. SLF4J: Class path contains multiple SLF4J bindings

Spring-boot-starter-web 패키지에는 Spring-boot-starter-logging을 dependency로 참조하고 있다.
만약 여기서 Spring-boot-starter 를 pom.xml에 추가해 넣게 되면 충돌이 일어나게 되는 것이다.
log4j와 Spring-boot-starter를 둘다 추가했다면 Spring-Boot-starter dependency를 지워주면 된다.
5. JavaConfig로 aop autoproxy추가하기
JavaConfig파일
@Configuration
@EnableAspectJAutoProxy
@ComponentScan(basePackages = {"패키지이름"})
Logging파일
@Aspect
@Component