Spring Boot(Gradle)プロジェクトをIntelliJ Community Editionで起動するまで
はじめに
IntelliJ Community EditionでGradleプロジェクトのSpring Bootを取り込む方法が見つけられなかったのでまとめた
普段仕事ではEclipse使っているが、Eclipseだけ使っていると
これじゃない気がするが、あるべき姿が良くわからない
という問題に陥る
IntelliJを使うことでこの問題解消出来たら良いな
Java
MacだとWindowsと違いすぎて不安になる
とりあえず最新で入れた
.bash_profileには以下のような感じで
export JAVA_HOME=`/usr/libexec/java_home -v 10`
$ java -version java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Java10にしてみた
Spring Boot(ver. 2.0.3)
Spring Initializr
まずはSpring Initializrで色々入れる、知っているやつ色々入れてみた
- PostgreSQL
- Spring Integration
- Thymeleaf
- flyway
IntelliJ(Version 2018.1.5)
基本的に設定はデフォルト、Use auto-import だけonにしている
Gradle wrapper(= gradlew)を使用
Gradleが使うJavaをJava10に変更
アプリ起動
ヘッダーのRun > Run
デフォルトのアプリ動かすだけで割と時間を食ってしまった...
IntelliJはTipsとか見ながら慣れていくことにする
その他
上記構成だと起動は出来るが起動時に以下の警告が出る Spring coreで不適切なリフレクションを使っている? 家で遊ぶだけだからとりあえず放置
2018-07-08 00:02:09.802 INFO 10799 --- [ main] o.s.i.config.IntegrationRegistrar : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/Users/urara/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.0.7.RELEASE/54b731178d81e66eca9623df772ff32718208137/spring-core-5.0.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release