-
Spring 프로젝트 테스트 중 resources/templates/data.sql 파일 내부 SQL 구문을 입력 후 html 문서로 (thymeleaf) 나타낼 때 한글 깨짐 현상이 발생했다. 해결 방법 📝 application.yml 인 경우 spring.sql.init.encoding=UTF-8 📝 application.properties 인 경우 spring: sql: init: encoding: UTF-8 작성 후 실행해보면 정상적으로 한글이 나오게된다.
[Springboot] data.sql 한글 깨짐 현상 해결 방법 (.html or H2 DB)Spring 프로젝트 테스트 중 resources/templates/data.sql 파일 내부 SQL 구문을 입력 후 html 문서로 (thymeleaf) 나타낼 때 한글 깨짐 현상이 발생했다. 해결 방법 📝 application.yml 인 경우 spring.sql.init.encoding=UTF-8 📝 application.properties 인 경우 spring: sql: init: encoding: UTF-8 작성 후 실행해보면 정상적으로 한글이 나오게된다.
🗓️ 2024.01.05 🗨️1 -
▶ 예외 (Exception) - 사용자의 잘못된 조작 또는 개발자의 잘못된 코딩으로 인한 오류 - 예외가 발생되면 프로그램 종료 - 예외 처리 추가하면 정상 실행 상태로 돌아갈 수 있음 1) 컴파일 오류 (Complie Error) : 컴파일 불가 2) 런타임 오류 (Runtime Error) : 실행 중 오류 3) 논리 오류 (Logical Error) : 버그 (흐름상 잘못된 코딩) => 해결이 제일 어려움 (1) 예외 처리 예시 package prac01; public class ErrorExam { public static void main(String[] args) { String str = null; try { System.out.println(4 / 0); // Arithmetic Syst..
[Springboot] 스프링부트 예외처리 (try~catch~finally)▶ 예외 (Exception) - 사용자의 잘못된 조작 또는 개발자의 잘못된 코딩으로 인한 오류 - 예외가 발생되면 프로그램 종료 - 예외 처리 추가하면 정상 실행 상태로 돌아갈 수 있음 1) 컴파일 오류 (Complie Error) : 컴파일 불가 2) 런타임 오류 (Runtime Error) : 실행 중 오류 3) 논리 오류 (Logical Error) : 버그 (흐름상 잘못된 코딩) => 해결이 제일 어려움 (1) 예외 처리 예시 package prac01; public class ErrorExam { public static void main(String[] args) { String str = null; try { System.out.println(4 / 0); // Arithmetic Syst..
🗓️ 2023.11.13 🗨️0 -
▶ 데이터 수집 1. 기본 방법으로 수집 package prac01; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class 데이터수집1 { public static void main(String[] args) throws IOException { URL url = new URL("http://ggoreb.com/quiz/harry_potter.txt"); URLConnection con = url.openConnection(); InputStream in = con.getInputStream(); // getFileInputStream(); 으..
[Springboot] 스프링부트 데이터 수집▶ 데이터 수집 1. 기본 방법으로 수집 package prac01; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class 데이터수집1 { public static void main(String[] args) throws IOException { URL url = new URL("http://ggoreb.com/quiz/harry_potter.txt"); URLConnection con = url.openConnection(); InputStream in = con.getInputStream(); // getFileInputStream(); 으..
🗓️ 2023.11.13 🗨️0 -
▶ File 클래스 - java.io 패키지에서 제공 - 파일 및 폴더 정보 제공 File file = new File("C:/Temp/file.txt"); File file = new File("C:\\Temp\\file.txt"); - 파일이나 폴더가 존재하는지 확인하려면 exists() 메소드 호출 boolean isExist = file.exists(); - exists() 메소드의 반환값이 false 인 경우 다음 메소드로 파일 또는 폴더 생성 - exists() 메소드의 반환값이 true 인 경우 다음 메소드로 파일 또는 폴더 생성 File dir = new File("text"); if(!dir.exists()) {dir.mkdirs();} File file1 = new File("text/..
[Springboot] 스프링부트 파일 클래스(File Class)▶ File 클래스 - java.io 패키지에서 제공 - 파일 및 폴더 정보 제공 File file = new File("C:/Temp/file.txt"); File file = new File("C:\\Temp\\file.txt"); - 파일이나 폴더가 존재하는지 확인하려면 exists() 메소드 호출 boolean isExist = file.exists(); - exists() 메소드의 반환값이 false 인 경우 다음 메소드로 파일 또는 폴더 생성 - exists() 메소드의 반환값이 true 인 경우 다음 메소드로 파일 또는 폴더 생성 File dir = new File("text"); if(!dir.exists()) {dir.mkdirs();} File file1 = new File("text/..
🗓️ 2023.11.13 🗨️0 -
▶ 입출력 스트림의 종류 1. Byte Stream : 그림, 멀티미디어 등의 바이너리 데이터 읽고 쓰기 => InputStream 과 OutputStream 을 주로 사용. package prac01; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class ByteStream { public static void main(String[] args) throws IOException { InputStream in = new FileInputStream("a.bin"); byte[] buffer = new byte[..
[Springboot] 스프링부트 입출력 스트림▶ 입출력 스트림의 종류 1. Byte Stream : 그림, 멀티미디어 등의 바이너리 데이터 읽고 쓰기 => InputStream 과 OutputStream 을 주로 사용. package prac01; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class ByteStream { public static void main(String[] args) throws IOException { InputStream in = new FileInputStream("a.bin"); byte[] buffer = new byte[..
🗓️ 2023.11.13 🗨️0 -
▶ Springboot 에서 H2 실행 - 의존성 추가 spring.datasource.url=jdbc:h2:C:/Users/user/Desktop/Module1_Web/Springboot/basic/test spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.jpa.hibernate.ddl-auto=update spring.jpa.database-platform=org.hibernate.dialect.H2Dialect # 테이블이 생성될때마다 id값이 계속 늘어나는 것 방지(sqlite 에서는 못쓰고 h2 에서 사용 가능한 기능) # spring.jpa...
[Springboot] 스프링부트 H2 연동▶ Springboot 에서 H2 실행 - 의존성 추가 spring.datasource.url=jdbc:h2:C:/Users/user/Desktop/Module1_Web/Springboot/basic/test spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.jpa.hibernate.ddl-auto=update spring.jpa.database-platform=org.hibernate.dialect.H2Dialect # 테이블이 생성될때마다 id값이 계속 늘어나는 것 방지(sqlite 에서는 못쓰고 h2 에서 사용 가능한 기능) # spring.jpa...
🗓️ 2023.11.13 🗨️0