분류 전체보기(10)
-
예외처리 클래스 만들기[스프링 예외 처리]
개발을 하다 보면 에러 상태 코드는 무조건 접하게 된다. 그렇다면 에러 상태별로 내가 만든 화면으로 이동을 시키거나 내가 해주고 싶은 응답을 할 수 는 없을까? 당연히 있다. 클래스에 @ControllerAdvice 를 해주면 모든 클래스에서 예외가 발생했을때 해당 클래스가 실행된다. 이런식으로 @ControllerAdvice를 해주고 @ExcptionHandler 메서드를 만들어 주면 되는데 ExcptionHandler에 에러 타입을 작성해주고 ex) 예로들어 위에 보듯이 NullPointerException에러 발생시 저 메서드가 실행되는 것이다. model.addAttribute("ex",ex); 로 jsp에 에러 내용을 내가 만든 error.jsp 화면에서 보여 줄 수 있다. 또 @Response..
2023.03.29 -
인텔리제이 DBMS: MySQL (no ver.) (protocol is disabled or cipher suites are inappropriate). 해결
인텔리제이에 My-SQL을 연결하려고 하는데 Test Connection을 누르니까 DBMS: MySQL (no ver.) Case sensitivity: plain=mixed, delimited=exact [08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. No appropriate protocol (protocol is disabled or cipher suites are inappropriate). 이런 이유로 계속 연결이 안되어서 삽질을 계속했다. 해결방법은..
2023.03.28 -
이클립스 콘솔 한글깨짐 해결방법
이클립스로 프로젝트중 Console창에 한글이 깨지는 현상이 발생했다. 해결방법은 매우 간단하다. 프로젝트 마우스 우클릭 -> Run As -> Run Configurations -> Common의 경로로 들어가서 Encoding의 Other 부분에 MS949를 입력해주면 된다. UTF-8로 설정해도 되지만 UTF-8로 설정하여도 한글이 깨지는 경우가 있는데 윈도우 버전은 MS949로 입력해지면 콘솔 한글깨짐 현상이 해결된다.
2023.03.22 -
[spring] profile로 서버 환경에 맞는 Context 적용(Dspring.profiles.active)
아직 신입이라 현업에 종사하면서도 파악하기 바쁜 요즘 tomcat에서 -Dspring.profiles.active을 설정하는것을 보았다. 왜 설정하는지 모르고 사용하였는데 궁금해서 정리할겸 끄적여본다. 프로젝트 마우스 우클릭 -> run as -> run configuratins -> Arguments -> VM arguments에 -Dspring.profiles.active 설정한다. 왜 설정하는지 검색해보니 WAS를 복수이상으로 사용할때 같은 Spring을 사용하지만 각 서버에 맞게 Context를 설정해야 하는 경우에 사용한다고 한다. 예로들어서 main과 devel(개발용) 으로 서버를 분리해서 관리할때 활용할수 있는것이 Spring.Profile이다. 프로젝트 마우스 우클릭 -> run as -..
2023.03.21 -
flutter TextEditingController 삼항연산자
flutter로 앱개발중 TextEditingController의 값을 확인하여 빈값일때와 값이 있을때의 Text를 다르게 표현하려고 하였다. final TextEditingController _textController = TextEditingController(text: '이렇게 하면 초기값 설정 가능!!'); (_textController.toString()=='' || _textController.toString().isEmpty) ? const Text('서버 설정', style: LoginStyle.loginButtonTextStyle).tr() : const Text('서버 재설정', style: LoginStyle.loginButtonTextStyle).tr(), 이런식으로 빈값을 체크해서..
2022.12.21 -
SpringBoot Rest API JSON
annotation을 사용하여 class 변수를 자동으로 json으로 변환해 준다. Class 에 @RestController가 있어야 한다. Class @Controller로 되어있다면 Funtion(메서드)에 @ResponseBody 가 있어야 한다. RestController는 @Controller와 @ResponseBody .가 합쳐진 것이라고 보면된다. 예를 들어보자 1. vo만들고 (@Getter, @Setter 있어야 한다람쥐🐭) @Getter @Setter public class TestVO { public String testName; public String author; public Date createDate; } 2.Controller 에서 return 타입을 Object나 tes..
2022.12.07