[Spring WebFlux] 왜 WebFlux를 선택했는가? (Tomcat NIO와 비교)
·
Spring Framework/Spring & Spring Boot
들어가며티켓팅 프로젝트에서 Spring WebFlux를 사용했다는 이야기를 하면 종종 이런 질문을 받습니다.“톰캣도 NIO를 지원하는데, 굳이 WebFlux를 선택한 이유가 뭔가요?” 저도 처음에는 “어차피 둘 다 non-blocking이면 큰 차이가 없지 않을까?” 라고 생각했지만, 실제로 비교해보면 철학과 활용 범위에서 확실한 차이가 있었습니다. 이번 글에서는 WebFlux와 Tomcat NIO를 비교하며 WebFlux를 선택한 이유를 정리해 보겠습니다.아키텍처의 차이Tomcat NIOServlet API 기반으로 동작필터 체인, Request/Response 객체 등 서블릿 스펙의 제약 존재WebFluxReactive Streams 표준 기반Netty 같은 이벤트 루프 서버에 최적화서버-프레임워크-..
[Error] Field repository in required a bean of type 'xxx' that could not be found.
·
Error
# Error Intellij에서 @Autowired를 통해서 CrudRpository를 상속받는 인터페이스를 사용할 때 아래와 같은 error가 발생한다. Field repository in com.example.SpringDataJDBCSample.SpringDataJdbcSampleApplication required a bean of type 'xxx' that could not be found. # Solution @EnableJdbcRespositories을 통해 JDBC Repository 를 활성화 할 수 있다. @SpringBootApplication @EnableJdbcRepositories(basePackages = { "path of target package ex) com.demo..
[Error] Could not autowire. No beans of 'xxxx' type found.
·
Error
# Error Intellij에서 @Component를 부여한 클래스의 인스턴스를 @Autowired를 통해 사용하는 클래스의 필드에 주입하려면 'Could not autowire. No beans of 'xxxx' type found.'의 error가 발생한다. # Solution @ComponentScan을 통해 패키지의 @Component 을 스캔할 수 있다. @SpringBootApplication @ComponentScan(basePackages = { "path of package ex) com.demo" }) public class DemoApplication { public static void main(String[] args) { ... } @Autowired Sample sample;..