-
[스프링부트/웹 애플리케이션 개발]스프링부트스타터 프로젝트 생성, 스프링부트버전확인, lombok스프링&스프링부트 2023. 1. 2. 15:43
1. 프로젝트 생성
스프링 부트 스타터(https://start.spring.io/)
- dependencies
> spring web
> thymeleaf
> spring data JPA
> H2 Database
> Lombok
> Validation
2. 스프링부트 버전 확인
- build.gradle 에서 확인 가능
3. run > 오류 해결
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-01-02 14:53:06.504 ERROR 21048 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :Web server failed to start. Port 8080 was already in use.
[스프링부트] Port 8080 is already in use 에러
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2023-01-02 14:53:06.504 ERROR 21048 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : Web server failed to start. Port 8080 was already in
gitofjy.tistory.com
4. http://localhost:8080/ 확인하기, error page가 나오면 성공
5. test > java > JpashopApplicationTest
> test 실행 : 설정이 잘 되었는지 간단히 확인
6. lombok 적용 확인
preference > plugin > lombok 검색 실행 (재시작)
Preferences Annotation Processors 검색 > Enable annotation processing 체크 (재시작)
임의의 테스트 클래스를 만들고 @Getter, @Setter 확인
1) Hello 임의의 class 생성
package jpabook.jpashop; import lombok.Getter; import lombok.Setter; @Getter @Setter public class Hello { private String data; }
2) main 코드 작성
public static void main(String[] args) { Hello hello = new Hello(); hello.setData("hello"); String data = hello.getData(); System.out.println("data = " + data); SpringApplication.run(JpashopApplication.class, args); }
3) 출력 확인
728x90'스프링&스프링부트' 카테고리의 다른 글
[스프링부트/웹 애플리케이션 개발]라이브러리 (0) 2023.01.02 [스프링부트/인텔리제이]window 단축키 (1) 2023.01.02 스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술 후기 (0) 2022.12.19 인프런 스프링 입문 11 / AOP (0) 2022.12.18 인프런 스프링 입문 10 / JPA, 스프링 데이터 JPA (0) 2022.12.15