본문 바로가기

일이야기12

생성자 주입에 대하여... 필드 주입을 하더라도 SpringBoot 2.6 이후 순환 참조가 기본적으로 금지되도록 변경되었다. @Service public class ServiceA { @Autowired ServiceB serviceB; public void test() { serviceB.test(); } } @Service public class ServiceB { @Autowired ServiceA serviceA; public void test() { serviceA.test(); } } 굳이 순환참조를 허용하려면 application.properties에 다음을 추가해야 한다. spring.main.allow-circular-references=true 물론 생성자 주입을 사용함으로써 발생 가능한 코드 악취를 제거할 수.. 2022. 5. 17.
Intellij 에서 springboot live reload 1. Maven / Gradle 로 devtools 추가 Maven org.springframework.boot spring-boot-devtools true Gradle dependencies { compileOnly("org.springframework.boot:spring-boot-devtools") } 2. Intellij 에서 Build project automeatically 체크 3-1. 2021.2 이전 버전 intellij 에서 compiler.automake.allow.when.app.running 체크 (2021.2 이전) 3-2. 2021.2 이후 버전 intellij 에서 Allow auto-make to start even if developed application is cur.. 2022. 5. 16.
mybatis에서 NumberformatException 처리 java.lang.NumberFormatException: For input string: “Y” ### Error querying database. Cause: java.lang.NumberFormatException: For input string: “Y” ### Cause: java.lang.NumberFormatException: For input string: “Y” Map dataMap = new HashMap(); dataMap.put("useYN", "Y"); . . dummyMapper.getData(dataMap); 서비스에서 useYN값을 Y로 셋팅하고 Mapper를 호출하였는데 왠걸... mybatis 에서 NumberformatException 에러를 내고 있다. 그것도 "Y" 라.. 2020. 7. 1.
BasicErrorController.error Ambiguous 처리 2019/09/18 - [일이야기/Spring] - Tomcat 구동시 ErrorPageFilter 에러 처리 Tomcat 구동시 ErrorPageFilter 에러 처리 기본적으로 Spring boot에서는 에러를 처리하는 filter가 자동으로 동작한다. 하지만 프로젝트에 따라 Application내에서 에러 핸들링을 달리해야 하는데 Filter에서 선처리하고 아래와 같은 에러 로그를 출력한다.. naning9.tistory.com 이전 글에서 ErrorPageFilter를 disabled하고 Application 내에서 에러페이지를 분기하려고 GlobalErrorController를 만들었는데 아래와 같은 에러가 발생했다. org.springframework.beans.factory.BeanCreat.. 2019. 9. 18.
반응형