1
0

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 Data REST HAL BrowserでSpringのRESTを動作確認

Posted at

Spring Data JPAプログラミング入門 - AmazonにSpring Data RESTのRESTクライアントにHAL Browserがある、と書いてあったので動かす。

準備

pom.xml
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.1.RELEASE</version>
	</parent>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-rest</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-rest-hal-browser</artifactId>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
		</dependency>
	</dependencies>
@RestController
@SpringBootApplication
public class App {
	@RequestMapping("/hoge")
	public String hoge() {
		return "{\"sdfsa\":\"hogehoge\"}";
	}

	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}
}

うごかす

http://localhost:8080/ にアクセス。

springrestdatahal.jpg

ただ、spring-data-restHALの動作確認が主用途なので、汎用のGUI RESTクライアントとしては微妙といったところか。上で書いたようにspring-data-rest以外の自前の@RestControllerにはアクセスできるのでローカルの動作確認用には使える…が、そのために依存性入れるのはちょっと微妙。

1
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?