본문 바로가기
728x90
반응형

Back Side/Framework > Spring Boot3

[Spring Boot] Component Scan Spring Boot에서 Hello, World라는 글자를 브라우저에 띄우고 싶다고 하자. 그러면 우리는 어떻게 실행시켜줘야 할까? HelloController가 아닌 MySteplyApplication을 run 시켜줄거다. 왜? 왜 글자가 있는 HelloController가 아니라 MySteplyApplication을 실행시킬까? Spring Boot의 Component ScanSpring Boot는 @SpringBootApplication 어노테이션이 붙은 클래스 기준으로, 하위 패키지에 있는 모든 Bean들을 자동으로 찾아 등록해준다. 이때 @SpringBootApplication 안에는 @ComponentScan이 숨어 있다. @ComponentScan(basePackages = "com.exam.. 2025. 4. 13.
[어노테이션] @RequiredArgsConstructor 의존성 주입 Lombok를 이용해서 코드를 줄일 수 있다. Update를 하기 위해 Service 클래스에 @Service public class CourseService { private final CourseRepository courseRepository; public CourseService(CourseRepository courseRepository) { this.courseRepository = courseRepository; } @Transactional public Long update(Long id, Course course) { Course course1 = courseRepository.findById(id).orElseThrow( () -> new IllegalArgumentException(".. 2021. 11. 21.
스프링 포트에러 해결 - "Web server failed to start. Port 8080 was already in use" 스프링 프로젝트 생성 후 실행해보니 "Web server failed to start. Port 8080 was already in use.라는 문구와 함께 실행이 되지 않았다 ❗️ 이전에도 같은 경험을 해서 https://7942yongdae.tistory.com/35 Error - Port 8080 was already in use Port 8080 was already in use 에러와 원인과 해결 방법 메시지 *************************** APPLICATION FAILED TO START *************************** Description: Web server failed to start. Port 8080 was.. 7942yongdae.tistory.c.. 2021. 11. 18.
728x90
반응형