본문 바로가기

java

(7)
Interface 상속 공부 (same signature interface method) interface 상속 시 같은 이름의 method를 가지는 경우 어떻게 처리되는지 궁금했다. 다음 코드를 컴파일 해보니, 별 문제없이 컴파일 되었다. //T.java public interface T { public void t(); } //T2.java public interface T2 { public void t(); } //Human.java public class Human implements T, T2 { @Override public void t() { System.out.println("talk!!"); } } //Main.java public class Main { public static void main(String[] args) { Human h = new Human(); h.t(..
[Spring] Unsatisfied dependency expressed through field spring 5 tutoroial을 하다가 "Unsatisfied dependency expressed through field " 에러가 났다. Bean 설정시 필요한 것들이 빠졌기 때문에 해당 Exception이 뜨는 것이라고 한다. 나의 경우는 ApplicationContext 생성자에 Configuration annotation이 달린 class를 모두 전달하지 않아서 해당 오류가 발생했었다. 예를 들면 다음과 같은 상황이다. config1.java @Configuration public class Config1 { @Bean public Class1 class1() { return new Class1() } } config2.java @Configuration public class Config..
package 경로 추가 (Eclipse) Eclipse에서 .java 파일만 추가했는데, 탐색기 속 src/main/java 아래에 잡히지 않아서 불-편했었다. 나는 다음과 같이 해결했다. 1. Project 우클릭 -> Build Path -> Configration Build Path 로 Properties를 연 뒤에 2. Java Build Path 에서 source tab 클릭 후, Add Folder로 추가 파일의 경로 추가. 다시해보니, 다음과 같이 해결할 수도 있다. 1. 추가 파일 우클릭 -> use as a source folder 참고 https://ojava.tistory.com/116
Unhandled exception type 에러 처리 (Exception) 책에 있는 throw 문을 작성 중에 Unhandled exception type message가 떳다. Java 문법 문제 인 것 같아서 구글링 해보니, 다른 분이 친절하게 정리해주셨다. 해결 방법은 다음과 같다. 1. try - catch 문으로 error handling 하기, 2. method에 throws Exception 을 추가하여 해당 함수가 Exception을 발생 시킬 수 있다고 명시해주기. Compile time에 해당 error를 처리하는 이유는 reference에 나와있다. This compile-time checking for the presence of exception handlers is designed to reduce the number of exceptions whic..
IllegalStateException : Cannot load configuration class 해결 java spring5 를 공부하는 도중 " java.lang.IllegalStateException: Cannot load configuration class" 에러가 났다. spring 버전이 맞지 않나 싶어 spring도 최근 버전(5.2.19)을 구해서 설치하니 됬다. 참고하는 책 초반 부분에도 JAVA 8 / Spring 5.0.2를 기준으로 작성했도 하니 이점 참고해야겠다. PS. 다른 분들은 Dependency를 수정해서 했다. https://cuna.tistory.com/134 https://stackoverflow.com/questions/68526936/cannot-load-configuration-class-error-spring-boot
maven/gradle 설치하기 (Ubuntu 20.04) maven은 전반적인 프로젝트 관리를 위한 프레임 워크이다. gradle은 그루비를 이용한 빌드 자동화 시스템이다. 컴파일/패키징부터 웹 배포까지 개발 주기 전반을 지원한다. 그루비는 JVM에서 작동하는 동적 타이핑 프로그래밍 언어이다. spring을 사용하기 위해서 다운 받으려고 한다. MAVEN 설치 1. maven.apache.org/index.html 에 접속하기 2. Download Tab에서 apache-maven bin 압축파일 다운하기. 3. 압축 풀기 4. 압축 해제한 폴더를 /opt 로 옮기기 (굳이 여기로 옮기지 않아도 됨) 5. PATH에 apache-maven 의 bin 경로 추가, 적용 #in .bashrc export PATH=$PATH:/opt/apach-maven-3.6.3..
JAVA 설치하기 (Ubuntu 20.04) 0. apt update 하기 $ sudo apt update && sudo apt upgrade 1. openjdk-11-jdk 설치 $ sudo apt install openjdk-11-jdk java 설치 확인 $ java -version openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing) $ javac -version javac 11.0.10 2. 환경 변수 설정 ~/.bashrc 파일에 다음 내용 추가 # ~/..