1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Spring Boot で Rest API 構築

Last updated at Posted at 2019-08-17

Outline

  • 手探りで Spring Boot を勉強しながら Rest API を構築していく
  • Qiita にはやった分だけ投稿していく

Create New Project

IntelliJ の Spring Initializr を使う
190817-0003.png

Spring Initializr

Project SDK: 1.8
Choose Initializr Service URL: Default (https://start.spring.io)

Project Metadata

Group: com.example
Artifact: spring-boot-rest-api
Type: Gradle Project (Generate a Gradle based project archive)
Language: Java
Packaging: Jar
Java Version: 8
Version: 0.0.1-SNAPSHOT
NAME: spring-boot-rest-api
Description: Demo project for Spring Boot
Package: com.example.springbootrestapi

Dependencies

Developer Tools: Spring Boot DevTools, Lombok
Web: Spring Web Starter
SQL: Spring Data JPA, MySQL Driver

Project Settings

Project name: spring-boot-rest-api
Project location: 適宜

Import Module from Gradle

一旦デフォルト設定のまま
OKでプロジェクト作成が完了

IntelliJ で Lombok 有効化

こちらを参照
https://reasonable-code.com/intellij-lombok/

設定ファイルを yml に変更

spring-boot-rest-api/src/main/resources/application.properties

リネームする

spring-boot-rest-api/src/main/resources/application.yml

とりあえず起動してみる

Run ボタンを押す
190817-0005.png

エラーになった

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-08-17 23:19:54.141 ERROR 29198 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

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).


Process finished with exit code 0

続きの予告

1
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?