일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- FLEX5
- FK 설정
- 파이도 환불
- IntelliJ
- 부산입국
- Lesson2
- 백준알고리즘
- database연결
- 데이터의 무결성
- 외래키설정
- 리눅스
- 설탕문제
- 언마운트
- FIDO 환불
- Lesson3
- 레노보노트북
- Linux
- 1463번
- 벤쿠버 렌트
- 캐나다워홀
- Java
- 벤쿠버렌트
- 엔테크서비스
- 자바
- 벤쿠버집구하기
- 프로그래머스
- QA엔지니어
- binaray_gap
- BC렌트
- codility
- Today
- Total
대충이라도 하자
Spring Boot Tutorial | Full Course [2021] (2) 본문
1. spring initializer로 스프링부트 생성하기
- 빌드 도구 : Maven
- 언어 : 자바
- Packaging은 jar로 : godaddy는 jar파일을 지원하지 않으므로 war 패키징 선택해야 함
- 추가 dependency : spring web / Spring data JPA / PostgreSQL Driver
- IDE : IntelliJ
2. IntelliJ에서 열고 빌드 해줍니다.
그런 다음, Main -> Application 클래스를 run해주면 아래와 같은 오류(?)가 발생
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
*** 다시 프로젝트 만들려고 새로 생성하니, 이렇게 나와서 너무 당황했는데 아무 설정 없으면 원래 나오는 거였구나....
아래와 같이 pom.xml 파일의 JPA dependency 부분을 주석 처리해주고 maven -> reload project 해주면 됨.
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>-->
3. Application 클래스에 추가해서 'localhost:8080'이 작동하게 만들어주기
- 첫번째로 클래스에 @RestController 달아주기
아래의 사진 설명에도 있지만 이는 아래의 클래스가 restful endpoint를 수행하게끔 만들어준다.
- 두 번째로 public String hello() 라는 메소드를 추가한 뒤, @GetMapping 추가
함수가 작동하기 위해 restful endpoint로 사용되기 위한 annotation 해주기
4. Json data로 던져주려면?
5. 다음은 아래 그림처럼 던져줄 거임!
'꼬꼬마 개발자 노트 > Spring' 카테고리의 다른 글
Spring Boot Tutorial | Full Course [2021] (6) (0) | 2021.06.11 |
---|---|
Spring Boot Tutorial | Full Course [2021] (5) (0) | 2021.06.11 |
Spring Boot Tutorial | Full Course [2021] (4) (0) | 2021.06.11 |
Spring Boot Tutorial | Full Course [2021] (3) (0) | 2021.06.11 |
Spring Boot Tutorial | Full Course 2021(1) (0) | 2021.06.11 |