SPRING(31)
-
@RequestParam
용도url 등을 통해 값을 입력받을 때, url에 입력한 key = value 의 내용들을 개발 언어와 바인딩 해준다. 문법컨트롤러 내 메서드 소괄호 내에 작성(@RequestParam("key") String key) 보다 명확한 표기는 value = 을 명시하는 것이지만, 너무 자주 사용되서 생략 가능하다.(@RequestParam(value = "key") String key) // url// http://localhost:8080/request-param?param=바인딩하라@GetMapping("requestparam") public void helloMVC(@RequestParam("param") String param) { System.out.println(param); /..
2024.08.04 -
자바 버전 오류
오류 내용xception in thread "main" java.lang.UnsupportedClassVersionError: com/first/spring/start/StartApplication has been compiled by a more recent version of the Java Runtime (class file version 66.0), this version of the Java Runtime only recognizes class file versions up to 61.0- 높은 버전에서 컴파일된 놈이라 하위 버전에서 실행이 안 됨. 상황spring 프로젝트 build 후.java -jar 로 스냅샷.jar 실행하려고 하자 오류 발생함. 체크 - 인텔리제이 project stru..
2024.08.03 -
build 해보기
터미널 등을 통해프로젝트 dir 까지 이동. 해당 디렉토리에 gradlew 파일이 있는지 확인 하고 ./gradlew build 터미널에서 뭐가 %도 쭊쭊 차오르고 완료되면 해당 프로젝트 디렉토리 - build 에 libs 폴더와 함게 스냅샷 파일이 생김. java -jar 스냅샷.jar 실행으로 실행됨.
2024.08.03 -
spring-boot-devtools
https://docs.spring.io/spring-boot/docs/1.5.16.RELEASE/reference/html/using-boot-devtools.html 20. Developer toolsApplications that use spring-boot-devtools will automatically restart whenever files on the classpath change. This can be a useful feature when working in an IDE as it gives a very fast feedback loop for code changes. By default, any entry on the classpathdocs.spring.io ClassPath에 있는..
2024.08.03 -
spring-boot-devtools 초기 설정 오류
오류 내용Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') 원인버전 문제적당히 사용량 많은 버전 집어서 썼더니 바로 오류가 터졌다.// // https://mvnrepository.com/artifact/org.springframework.boot/spr..
2024.08.03 -
테스트_@Transactional
테스트 클래스에 @Transactional 을 사용하면, 테스트 시작 전 트랜잭션을 실행하고, 테스트 완료 후 항상 롤백을 진행한다. 롤백으로 인해 db는 테스트 시작 전으로 돌아가므로, 매번 같은 테스트 코드로 매번 같은 결과를 낼 수 있다. ---- 트랜잭션이 뭔데? 트랜잭션이란? 데이터 베이스의 상태를 바꾸기 위해 수행되는 최소한의 작업 단위 이다. 하나의 트랜잭션은 commit 되거나, rollback 된다. 트랜잭션의 특성 - Atomic(원자성) - Consistency(일관성) - Isolation(독립성, 격리성) - Durability(영속성,지속성) 최소한의 작업 단위가 뭔대? 맘대로 써보는 생활 예시 상황 : 기쁨이는 엄마의 요청으로 심부름을 해야 한다. 트랜잭션 :'기쁨이는 돈을 지..
2024.02.27