본문 바로가기

자바19

6/5 - Mapper 클래스, 트랜잭션 제어 목차Mapper 클래스를 활용하여 자동 매핑리소스 폴더 아래에 java 폴더아래와같은 경로, 이름으로 Mapper 클래스가 있을 시 SqlSessionTemplate 으로 경로를 명시해주지 않아도 매핑하여 사용 가능Mapper가 자동으로 해당 XML을 찾아 매핑 시켜줌Service는 Mapper인터페이스를 주입 받아 사용주의 할 점은 파일명의 맨 앞이 대문자여야함!chap09 > StudentMapper 동일Config에는 @MapperScan 어노테이션을, 해당 매퍼 클래스에는 @Mapper를 사용하여 밝혀주어야 한다. package chap09;import java.util.List;import org.apache.ibatis.annotations.Mapper;@Mapperpublic interfac.. 2025. 6. 6.
5/22 - Servlet, 쿠키, 세션 목차Servlet Context서블릿 컨테이너 간의 연동을 위해 사용어플리케이션마다 존재기능서블릿에서 파일 접근자원 바인딩로그 파일컨텍스트에서 제공하는 설정 정보 제공WEB-INF 안에 web.xml 넣고 작성 name 홍길동package sec03.ex01;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletConfig;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import ja.. 2025. 6. 1.
코딩테스트 입문 - Day 20 직사각형 넓이 구하기class Solution { public int solution(int[][] dots) { int answer = 0; int o[] = dots[0]; for(int i = 1; i캐릭터의 좌표class Solution { public int[] solution(String[] keyinput, int[] board) { int[] answer = new int[2]; int boundw = board[0] /2; int boundh = board[1] /2; for(String move : keyinput){ switch(move){ .. 2025. 5. 5.
코딩테스트 입문 - Day 19 7의 개수class Solution { public int solution(int[] array) { int cnt = 0; for(int n : array){ String s = n+""; cnt += s.length() - s.replace("7","").length(); } return cnt; }}잘라서 배열로 저장하기import java.util.*;class Solution { public List solution(String my_str, int n) { ArrayList answer = new ArrayList(); int i = 0; while(tr.. 2025. 5. 5.
코딩테스트 입문 - Day 18 문자열안에 문자열class Solution { public int solution(String str1, String str2) { if(str1.contains(str2)){ return 1; } return 2; }}제곱수 판별하기import java.util.*;class Solution { public int solution(int n) { int sq = (int)Math.sqrt(n); int pow = (int) Math.pow((double)sq,2.0); if(n == pow){ return 1; } return 2; }}세균 증.. 2025. 4. 27.
코딩테스트 입문 - Day 17 숫자 찾기class Solution { public int solution(int num, int k) { String s = String.valueOf(num); String k1 = String.valueOf(k); int n = s.indexOf(k1); if(n == -1){ return -1; } return n+1; }}n의 배수 고르기import java.util.*;class Solution { public List solution(int n, int[] numlist) { List arr = new ArrayList(); for(int num : numlis.. 2025. 4. 27.
728x90
반응형