Spring Boot
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
// 一覧用テンプレート
#topicpath
----
#ls2
ひさしぶりにSpringみてみたら、Spring のApplicationを作成...
[[Spring Boot>https://projects.spring.io/spring-boot/]]
**やってみる [#b691ab09]
今回は、このチュートリアルから。
[[Getting Started · Building an Application with Spr...
$ curl http://localhost:8080/
ってアクセス出来るWEBサーバを立ち上げてみます。
*** GitからClone [#cfbccf6d]
$ git clone https://github.com/spring-guides/gs-spring-b...
Cloning into 'gs-spring-boot'...
remote: Counting objects: 970, done.
remote: Total 970 (delta 0), reused 0 (delta 0), pack-re...
Receiving objects: 100% (970/970), 424.60 KiB | 189.00 K...
Resolving deltas: 100% (620/620), done.
*** ソースの確認 [#qc101f4c]
$ cd gs-spring-boot/initial/
$ cat src/main/java/hello/Application.java
package hello;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBoot...
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(A...
System.out.println("Let's inspect the beans prov...
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
$ cat src/main/java/hello/HelloController.java
package hello;
import org.springframework.web.bind.annotation.RestContr...
import org.springframework.web.bind.annotation.RequestMa...
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
***ビルドと実行 [#v9be699d]
$ mvn package && java -jar target/gs-spring-boot-0.1.0.jar
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------------------------------...
[INFO] Building gs-spring-boot 0.1.0
[INFO] -------------------------------------------------...
... 割愛 ...
[INFO] -------------------------------------------------...
[INFO] BUILD SUCCESS
[INFO] -------------------------------------------------...
[INFO] Total time: 1.909 s
[INFO] Finished at: 2017-01-15T18:39:30+09:00
[INFO] Final Memory: 29M/464M
[INFO] -------------------------------------------------...
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.3.RELEASE)
... 割愛 ...
viewControllerHandlerMapping
viewResolver
websocketContainerCustomizer
welcomePageHandlerMapping
*** アクセスしてみる [#g94a6a7a]
$ curl http://localhost:8080/
Greetings from Spring Boot!
WEBサーバ(組み込みのTomcatっぽい)が起動している事が確認で...
** 全体の構造の確認[#lf8cc780]
Spring Bootによって起動される部分は Application.java です。
実際にクライアントから呼び出されるロジック部は HelloContr...
http://localhost:8080/
とURLのマッピングに従って呼び出すことができます。
**関連リンク [#s89856b6]
-[[Getting Started · Building an Application with Sp...
-[[ようやくSaStrutsを卒業してSpring bootデビューしたので...
**コンテンツ一覧 [#f3733076]
#ls2
----
SIZE(10){[[FrontPage]]}~
SIZE(10){現在のアクセス:&counter;}
終了行:
// 一覧用テンプレート
#topicpath
----
#ls2
ひさしぶりにSpringみてみたら、Spring のApplicationを作成...
[[Spring Boot>https://projects.spring.io/spring-boot/]]
**やってみる [#b691ab09]
今回は、このチュートリアルから。
[[Getting Started · Building an Application with Spr...
$ curl http://localhost:8080/
ってアクセス出来るWEBサーバを立ち上げてみます。
*** GitからClone [#cfbccf6d]
$ git clone https://github.com/spring-guides/gs-spring-b...
Cloning into 'gs-spring-boot'...
remote: Counting objects: 970, done.
remote: Total 970 (delta 0), reused 0 (delta 0), pack-re...
Receiving objects: 100% (970/970), 424.60 KiB | 189.00 K...
Resolving deltas: 100% (620/620), done.
*** ソースの確認 [#qc101f4c]
$ cd gs-spring-boot/initial/
$ cat src/main/java/hello/Application.java
package hello;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBoot...
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(A...
System.out.println("Let's inspect the beans prov...
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
$ cat src/main/java/hello/HelloController.java
package hello;
import org.springframework.web.bind.annotation.RestContr...
import org.springframework.web.bind.annotation.RequestMa...
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
***ビルドと実行 [#v9be699d]
$ mvn package && java -jar target/gs-spring-boot-0.1.0.jar
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------------------------------...
[INFO] Building gs-spring-boot 0.1.0
[INFO] -------------------------------------------------...
... 割愛 ...
[INFO] -------------------------------------------------...
[INFO] BUILD SUCCESS
[INFO] -------------------------------------------------...
[INFO] Total time: 1.909 s
[INFO] Finished at: 2017-01-15T18:39:30+09:00
[INFO] Final Memory: 29M/464M
[INFO] -------------------------------------------------...
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.3.RELEASE)
... 割愛 ...
viewControllerHandlerMapping
viewResolver
websocketContainerCustomizer
welcomePageHandlerMapping
*** アクセスしてみる [#g94a6a7a]
$ curl http://localhost:8080/
Greetings from Spring Boot!
WEBサーバ(組み込みのTomcatっぽい)が起動している事が確認で...
** 全体の構造の確認[#lf8cc780]
Spring Bootによって起動される部分は Application.java です。
実際にクライアントから呼び出されるロジック部は HelloContr...
http://localhost:8080/
とURLのマッピングに従って呼び出すことができます。
**関連リンク [#s89856b6]
-[[Getting Started · Building an Application with Sp...
-[[ようやくSaStrutsを卒業してSpring bootデビューしたので...
**コンテンツ一覧 [#f3733076]
#ls2
----
SIZE(10){[[FrontPage]]}~
SIZE(10){現在のアクセス:&counter;}
ページ名: