본문 바로가기

Backend72

Baeldung https://www.baeldung.com/ Java, Spring and Web Development tutorials Java, Spring and Web Development tutorials www.baeldung.com 2020. 5. 26.
MyBatis insert controller @Controller public class MemberController { @Autowired private MemberService memberService; @PostMapping("/addMember") public String addMember(Member member) { System.out.println(member.toString()); memberService.addMember(member); return "index"; } } service package ksmart35.springboot_mybatis.service; import org.springframework.beans.factory.annotation.Autowired; import org.springfr.. 2020. 5. 25.
JAVA - Generic Generic이란 Java에서 많이 쓰는 매커니즘 중에 하나 인스턴화시에 다룰 데이터 타입을 확정하는 것 다양한 타입의 객체들을 다루는 메서드나 클래스에 컴파일시에 타입을 체크 해주는 기능 다룰 객체의 타입을 미리 명시하여 객체의 형 변환이 불필요하다. Generic의 장점 타입의 안정성 형 변환 작업이 불필요 코드의 간결 2020. 5. 22.
JAVA 예외 던지기 Throw 직접 만드는 예외 예외를 직접 발생시킬 경우 키워드 throw를 활용한다. public static void main(String[] args) throws Exception { throw new Exception("예외 강제 발생"); } package kr.or.ksmart; class MyExecption extends Exception { public MyExecption() { super(); } public MyExecption (String msg) { super(msg + " < My 클래스의 필수값 누락 MyExecption "); } } class My { private String name; public My(String name) throws MyExecption { if(name .. 2020. 5. 20.
JAVA 예외처리하기 RuntimeException 작업을 하다보면 생기는 여러 에러들... 에러가 생기면 에러 이후에는 멈춰버리는 로직 그 때 에러에 예외처리를 통해 에러를 무시하고 다음 로직이 실행 될 수 있게 한다. 크게 예외 처리를 안해도 되는 언체크 예외와 예외 처리를 꼭 해야하는 체크 예외가 있다. 언체크 예외 = RuntimeException RuntimeException은 기본적으로 예외처리를 안해도 되는 경우인데 흔히 자주 나타나는 에러나 프로그래머들이 조금만 주의하면 잡을 수 있는 에러들이다. ① ArithmeticException : 0으로 나눴을 때 생기는 에러 int n = 0; int n1 = 3 / n; Exception in thread "main" java.lang.ArithmeticException: / by zero at.. 2020. 5. 20.
thymeleaf utility objects https://www.baeldung.com/spring-thymeleaf-3-expressions Spring and Thymeleaf 3: Expressions | Baeldung A quick and practical guide to using Thymeleaf's Expression Utility Objects with Spring MVC www.baeldung.com 2020. 5. 19.
728x90
반응형