처음부터 차근차근
@PostConstruct, @PreDestroy 에러 본문
반응형
에러 : PostConstruct cannot be resolved to a type
위와 같이 @PostConstruct, @PreDestroy를 사용하려 했더니 에러가 생긴다.
에러를 클릭해보면 import같은 걸로도 해결할 수 도없다.
해결 : pom.xml에 밑의 코드를 추가해준다.
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
javax.annotations 종속성을 추가해주면 해결되는 문제다.
그리고 다시 에러가 났던 클래스로 돌아가서
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
해주면 된다.
반응형
'Error&Warning' 카테고리의 다른 글
[warning] git - LF will be replaced by CRLF (0) | 2021.09.24 |
---|---|
@Configuration 오류 (0) | 2021.09.23 |
web.xml 에러 (0) | 2021.09.14 |
Eclipse Spring MVC 프로젝트 실행할 때 404 error(Spring 동작 원리) (1) | 2021.09.14 |
log4j에러 (0) | 2021.09.14 |
Comments