Spring Boot ã§ã¡ã¼ã«éä¿¡ãã Web ã¢ããªã±ã¼ã·ã§ã³ãä½ã ( çªå¤ç·¨ )( IntelliJ IDEA Ultimate Edition ã®ã¤ã³ã¹ãã¼ã« )
æ¦è¦
Community Edition ãã¤ã³ã¹ãã¼ã«ãã¦ãã PC ã« Ultimate Edition ãã¤ã³ã¹ãã¼ã«ãã¦éçºç°å¢ã移è¡ãã¾ãã
ï¼åã«åãã¦è¡ãäºå®ã§ããä»å㯠Ultimate Edition ã®ã¤ã³ã¹ãã¼ã«ã¨æ©è½ã®ç¢ºèªã次å㯠Doma 2 ã® IntelliJ Doma support plugin ã JRebel ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ã¾ãã
ã¤ã³ã¹ãã¼ã«ããå¾ã«ããããããã£ã¦ã¿ã¾ããããUlitimate Edition ãã£ã±ã便å©ã§ãã
æé
Ultimate Edition ã®ã¤ã³ã¹ãã¼ã©ã®ãã¦ã³ãã¼ã
- Download IntelliJ IDEA 14.1 ã®ãã¼ã¸ã§ Ultimate Edition ã®ãDownload Ultimateããã¿ã³ãã¯ãªãã¯ã㦠ideaIU-14.1.3.exe ããã¦ã³ãã¼ããã¾ãã
Ultimate Edition ã®ã¤ã³ã¹ãã¼ã«
ideaIU-14.1.3.exe ãèµ·åãã¾ãã
ãIntelliJ IDEA Setupããã¤ã¢ãã°ã表示ããã¾ãããNext >ããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãLicense Agreementãç»é¢ã表示ããã¾ãããI Agreeããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãChoose Install Locationãç»é¢ã表示ããã¾ãããDestination Folderãã« C:\IntelliJ_IDEA\14.1.3 ãå ¥åããå¾ããNext >ããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãInstallation Optionsãç»é¢ã表示ããã¾ããä½ããã§ãã¯ããã«ãNext >ããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãChoose Start Menu Folderãç»é¢ã表示ããã¾ãããInstallããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãInstallingãç»é¢ã表示ãããã¤ã³ã¹ãã¼ã«ãå®è¡ããã¾ãã
ã¤ã³ã¹ãã¼ã«ãå®äºããã¨ãCompleting the IntelliJ IDEA Setup Wizardãç»é¢ã表示ããã¾ããç»é¢ä¸å¤®ã®ãRun IntelliJ IDEAããã§ãã¯ããã¯ã¹ããã§ã¯ããå¾ããFinishããã¿ã³ãã¯ãªãã¯ãã¾ãã
Ultimate Edition ã®èµ·å
IntelliJ IDEA Ultimate Edition ãèµ·åããã¨æåã«ãComplete Installationããã¤ã¢ãã°ã表示ããã¾ãããI want to import my settings from a custom locationããé¸æãã¦ããã®ä¸ã®ãSpecify config folder or installation home ...ãã« Community Edition ãã¤ã³ã¹ãã¼ã«ãã¦ãã C:\IntelliJ_IDEA\14.1.2 ãå ¥åããå¾ããOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãIntelliJ IDEA License Activationããã¤ã¢ãã°ã表示ããã¾ããã©ã¤ã»ã³ã¹è³¼å ¥æã«å ¥æããã¦ã¼ã¶å㨠License key ãå ¥åãã¦ãOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãLicense Agreement for IntelliJ IDEA 14.1.3ããã¤ã¢ãã°ã表示ããã¾ãããAccept all terms of the licenseããã§ãã¯ããã¯ã¹ããã§ãã¯ããå¾ãOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
IntelliJ IDEA ã®ã¡ã¤ã³ç»é¢ã表示ããã¾ãã
- CPU 使ç¨çãç°å¸¸ã«ä¸æã Indexing ã®ã¡ãã»ã¼ã¸ãç»é¢ä¸é¨ã«è¡¨ç¤ºããã¦ãã¾ãããä½ãæ´æ°å¦çããã¦ããããã§ãã
- ã¿ã¹ã¯ããã¼ã¸ã£ãèµ·åãã¦ç¶æ³ã確èªãã㨠idea.exe ã® CPU使ç¨çã 100% è¿ãã«ãªã£ã¦ããã®ã¨ã32bit çã® exe ãèµ·åããã¦ãããã¨ã確èªããã¾ããã
32bitçãèµ·åãã¦ããã®ã§ 64bitçãèµ·åãç´ãã¾ããèµ·åä¸ã® IntelliJ IDEA ãçµäºãã¾ãã
C:\IntelliJ_IDEA\14.1.3\bin ã®ä¸ã® idea64.exe ãå®è¡ãã¾ãã
IntelliJ IDEA ã®ã¡ã¤ã³ç»é¢ã表示ããã¾ããç»é¢å³ä¸ã«ãSpring Configuration CheckããUnindexed remote maven repositories found.ãã®ã¡ãã»ã¼ã¸ã表示ããã¾ãã
ãUnindexed remote maven repositories found.ãã®ã¡ãã»ã¼ã¸ã®ä¸ã«è¡¨ç¤ºããã¦ãããOpen Repositories Listããªã³ã¯ãã¯ãªãã¯ãã¾ãã
ãSettingsããã¤ã¢ãã°ã表示ããããBuild, Execution, Deploymentã-ãBuild Toolsã-ãMavenã-ãRepositoriesããé¸æããã¾ããç»é¢å³å´ã®ãIndexed Maven Repositoriesãã®ãªã¹ãã«è¡¨ç¤ºããã¦ãã以ä¸ã®ï¼ã¤ã®ã¬ãã¸ããªã® Update ã "Never" ã¨è¡¨ç¤ºããã¦ããã®ã§ãé¸æãã¦ãUpdateããã¿ã³ãæ¼ãã¦æ´æ°ãã¾ãã
â»æéãçµæ§ãããã¾ãã
ã¡ã¤ã³ç»é¢ã«æ»ãã¾ãã念ã®çºãGradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ãã¾ãã
ã¡ã¤ã³ã¡ãã¥ã¼ãããFileã-ãClose Projectããé¸æãã¦ããã¸ã§ã¯ããä¸æ¦ã¯ãã¼ãºãã¾ãã
ãWelcome to IntelliJ IDEAãç»é¢ã表示ããã¾ããç»é¢å·¦å´ã®ãªã¹ããã ksbysample-webapp-email ãé¸æãã¦ããã¸ã§ã¯ããéãç´ãã¾ãã
åã³ IntelliJ IDEA ã®ã¡ã¤ã³ç»é¢ã表示ããã¾ããç»é¢å³ä¸ã«ãSpring Configuration Checkãã®ã¡ãã»ã¼ã¸ã表示ããã¾ãã
ã¡ã¤ã³ã¡ãã¥ã¼ãããFileã-ãProject Structure...ããé¸æãã¾ãã
ãProject Structureããã¤ã¢ãã°ã表示ããã¾ããç»é¢å·¦å´ã®ãªã¹ããããProject Settingsã-ãFacetsããé¸æ â ç»é¢ä¸å¤®ã®ãªã¹ããããSpringã-ãSpring (ksbysample-webapp-email)ããé¸æ â ç»é¢å³å´ã®ãªã¹ããããSpring Application Contextããé¸æããå¾ããEditããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãEdit Application Context 'Spring Application Context'ããã¤ã¢ãã°ã表示ããã¾ããç»é¢ä¸å¤®ã®ãã¡ã¤ã«ãå ¨ã¦ãã§ãã¯ããå¾ãOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
â»ãããä½ã®è¨å®ãããåãããªãã®ã§ãããã¡ãã»ã¼ã¸ã表示ããã¦ããã®ã§åºãªãããã«ãã¾ãã
ãProject Structureããã¤ã¢ãã°ã«æ»ãã¾ãã®ã§ãOKããã¿ã³ãã¯ãªãã¯ãã¦ã¯ãã¼ãºãã¾ãã
å度ããã¸ã§ã¯ããã¯ãã¼ãº â ãªã¼ãã³ãç´ãã¦ãSpring Configuration Checkãã®ã¡ãã»ã¼ã¸ã表示ãããªããã¨ã確èªãã¾ãã
Gradle projects View ãã clean ã¿ã¹ã¯ãå®è¡å¾ãã¡ã¤ã³ã¡ãã¥ã¼ãããBuildã-ãRebuild Projectããé¸æãã¨ã©ã¼ãåºãªããã¨ã確èªãã¾ãã
ãã¹ããæ£å¸¸ã«åä½ããã確èªãã¾ããProject View ã®ã«ã¼ãã§ã³ã³ããã¹ãã¡ãã¥ã¼ã表示ããRun 'Tests in 'ksbysample...' with Coverageããé¸æãã¾ãã
ãã¹ããæ£å¸¸ã«çµäºã "All Tests Passed" ã®æåã表示ããã¾ããã
Gradle projects View ãã build ã¿ã¹ã¯ãå®è¡ãã"BUILD SUCCESSFUL" ã®ãã°ãåºåããããã¨ã確èªãã¾ãã
Tomcat ãèµ·åãã¦åä½ã確èªãã¾ããGradle projects View ãã bootRun ã¿ã¹ã¯ãå®è¡ãã¾ããCommunity Edition ã®æã¨éããèµ·åæã« ch.qos.logback ã®ãã°ãåºåããã¦ãã¾ããã
smtp4dev ãèµ·åãã¦ãç»é¢ã®è¡¨ç¤ºãã¡ã¼ã«ã®éä¿¡ã試ãã¾ããããæ£å¸¸ã«åä½ãã¾ããã
Ctrl+F2 ãæ¼ã㦠Tomcat ãåæ¢ãã¾ããsmtp4dev ãçµäºãã¾ãã
ä¸è¨ä»¥å¤ã«æ°ã«ãªã£ãç¹ãè¨è¼ãã¦ããã¾ãã
applicationContext.xml ã®ä¸ã® transactionManager ã赤æåã§è¡¨ç¤ºããã¦ãã¾ãããtransactionManager Bean 㯠Web ã¢ããªã±ã¼ã·ã§ã³å´ã§æªå®ç¾©ã®å ´åã« Spring Boot ãèªåçæããã®ã§ãã ( ãã ã build.gradle ã« spring-boot-starter-data-jpa ãè¨è¿°ãã¦ãããã¨ãæ¡ä»¶ã§ã )ããã®ãã㪠Bean ã¯èªèãããªãããã§ããããã¯ãã®ã¾ã¾ã«ãã¾ãã
src/main/java/ksbysample/webapp/email/helper/mail ã®ä¸ã® MAIL001MailHelper.java ãéãã¨ãgetter ã¡ã½ãããå ¨ã¦èµ¤æåã§è¡¨ç¤ºããã¦ãã¾ããã
Lombok Plugin ãã¤ã³ã¹ãã¼ã«ãç´ãã¾ãã ( ã¤ã³ã¹ãã¼ã«æ¹æ³ã¯ Spring Boot ã§ã¡ã¼ã«éä¿¡ãã Web ã¢ããªã±ã¼ã·ã§ã³ãä½ã ( ãã®ï¼ )( Project ã®ä½æ ) åç § )ãCommunity Edition ã§ã¤ã³ã¹ãã¼ã«ãã¦ãã Plugin ã¯å¼ãç¶ãããªãããã§ãã
src/main/resources/templates/mailsend ã®ä¸ã® mailsend.html ã§
th:replace="common/head-cssjs"
ã®head-cssjs
ã®é¨åã«èµ¤æ³¢ç·ãå¼ããã¦ãã¾ãããåå ãããåãããªãã®ã§ãããéçºåã³åä½ä¸æ¯éã¯ãªãããã§ãã®ã§ãã®ã¾ã¾ã«ãã¾ãã
Ultimate Edition ã®æ©è½ã使ã£ã¦ã¿ãã
Ultimate Edition ã§ä½¿ã£ã¦ã¿ããã¨æã£ã¦ããæ©è½ã試ãã¦ã¿ã¾ãã
Thymeleaf ã®è£å®æ©è½
src/main/resources/templates/mailsend ã®ä¸ã® mailsend.html ãéããã¿ã°ã«
th:
ã¨å ¥åãã¦ã¿ã㨠Thymeleaf ã®è£å®åè£ãåºã¦ãã¾ããã
Database Tools
IntelliJ IDEA ã®ç»é¢å³å´ã«ãDatabaseãã¨ããé ç®ã表示ããã¦ãã¾ãããããã¯ãªãã¯ãã¾ãã
Database View ãéãã¾ããå·¦ä¸ã®ãNewããã¿ã³ãã¯ãªãã¯ãã¦ããData Sourceã-ãPostgreSQLããé¸æãã¾ãã
ãData Sources and Driversããã¤ã¢ãã°ã表示ããã¾ããDatabaseãUserãPassword ãå ¥åãã¾ãã
JDBC Driver 㯠Web ã¢ããªã±ã¼ã·ã§ã³ã®ãã®ã使ç¨ããã®ã§ã¯ãªãç¬èªã«ãã¦ã³ãã¼ããã¾ãããã¤ã¢ãã°ã®ç»é¢å³ä¸ã®ãDriver filesãã®ä¸ã®ãdownloadããªã³ã¯ãã¯ãªãã¯ãã¾ãã
ãDriver filesãã®ä¸ã®æååã "Using PostgreSQL driver files" ã«å¤ããã¾ãã®ã§ããã®ä¸ã®ãPostgreSQLããªã³ã¯ãã¯ãªãã¯ãã¾ãã
ç»é¢å·¦å´ã®é¸æããã¦ããé ç®ããDriversã-ãPostgreSQLãã«å¤ãããç»é¢å³å´ã®ãDriver filesãã«è¿½å ããã JDBC Driver ã® jar ãã¡ã¤ã«ã表示ããã¾ãã
ç»é¢å·¦å´ã§ãData Sourcesã-ãPostgreSQL - ksbysample@localhostããé¸æããå¾ãç»é¢å³å´ã®ãTest Connectionããã¿ã³ãã¯ãªãã¯ãã¦ãConnection successfulãã表示ããããã¨ã確èªãã¾ãã確èªå¾ãOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãData Sources and Driversããã¤ã¢ãã°ã«æ»ãã¾ãã®ã§ãOKããã¿ã³ãã¯ãªãã¯ãã¦ã¯ãã¼ãºãã¾ãã
Database View ã«è¿½å ããè¨å®ã表示ãããksbyemail.public ã®ä¸ã«ãã¼ãã«ã表示ããã¾ããã¾ããã¼ãã«åãããã«ã¯ãªãã¯ããã¨ãã¼ãã«ã®ãã¼ã¿ã表示ããã¾ãã
ç°¡åã«ä½¿ã£ã¦ã¿ãæãã§ã¯ä»¥ä¸ã®ãã¨ãã§ãã¾ããã軽快ã ããäºæ³ããããããã§ãã¦ä¾¿å©ã§ããç¹ã«ãã¤ã¢ãã°è¡¨ç¤ºãCSV ãã¡ã¤ã«åºåæ©è½ãSQL ãã¡ã¤ã«ããã® SQL æå®è¡æ©è½ã¯æ°ã«å ¥ãã¾ããã
- ãã¼ãã«ã®ãã¼ã¿ã表示ããã ãã§ãªãç·¨éãã§ãã¾ãã
- DB å ã®(ãã¶ãå ¨ã¦ã®)ãªãã¸ã§ã¯ãã® DDL ãããã¼ãã«åå¥ã® DDL ã表示ãåºåã§ãã¾ãã
- Console ã表示ã㦠SQL ãå ¥åãã¦å®è¡ã§ãã¾ããselect æã§ããã°çµæã»ããã表示ãããCSV ãã¡ã¤ã«çã«åºåãããã¨ãã§ãã¾ãã
- GUI ã§ãã¼ãã«ãæ°è¦ä½æã§ãã¾ãã
- ï¼ã¤ã®ãã¼ãã«ãæ¯è¼ã§ãã¾ããã«ã©ã ã移åãããããã§ããããã§ã ( 試ãã¦ãã¾ãã )ã
ãã¼ãã«ã®ãã¤ã¢ã°ã©ã ãåºåã§ãã¾ã ( é¸æãããã¼ãã«ã ãåºåãããã¨ãå¯ )ãç»åãã¡ã¤ã«ã«ä¿åãããã¨ãã§ãã¾ãããã ã表示ããããã¤ã¢ãã°ã®ç»åãç´æ¥ã³ãã¼ãããã¨ã¯ã§ãã¾ããã§ãã ( ä¸åº¦ç»åãã¡ã¤ã«ã¨ãã¦ä¿åããå¿ è¦ãããã¾ã )ã
ãã¼ãã«ã®ãã¼ã¿ã CSV ãã¡ã¤ã«ã XMLãJSON çã®å½¢å¼ã§åºåãããã¨ãã§ãã¾ãã
è¨å®ããã°ã«ã©ã ãå é è¡ã«åºåã§ãã¾ãã
SQL ãã¡ã¤ã«ã§ãSQL æã®ææ³ãã§ãã¯ãè¡ããã¾ãã
â Data Source ãè¨å®ãã¦ããªãå ´å
â Data Source ãè¨å®ãã¦ããå ´å â»ã«ã©ã åãæ£ããå ´åãç´«è²ã®å¤ªåã§è¡¨ç¤ºããã¾ãã
SQL ãã¡ã¤ã«ã§ãRun ã¡ãã¥ã¼ã表示ãããããã«ãªãã¾ããé¸æãã㨠SQL æãå®è¡ãããã¨ã©ã¼ããªãã確èªã§ãã¾ãã
SQL ãã¡ã¤ã«ä¸ã§ Alt+Enter ãæ¼ãã¨ãRun Query in Consoleãã¡ãã¥ã¼ã表示ãããé¸æãã¦å®è¡ãã㨠Database Console 㧠SQL ãã¡ã¤ã«ãå®è¡ããã¦çµæã»ããã表示ããã¾ãã
SQL ãã¡ã¤ã«ã§ãDB ã®é¢æ°ä¸è¦§ã表示ããã¾ããPostgreSQL ã§ãã試ãã¦ãã¾ãããããã¶ã Oracle ãªã Oracle ã®ãMySQL ãªã MySQL ã®é¢æ°ã表示ãããã¨æããã¾ãã
SQL ãã¡ã¤ã«ã« SQL ãæ¸ãæã«ãDatabase View ããã«ã©ã ã Drag&Drop ã§æã£ã¦ããã¾ãã
SQL ãã¡ã¤ã«ã« SQL ãæ¸ãæã«ãã¼ãã«ãã«ã©ã ãSQL ã®äºç´èªã®ä¸è¦§ããã°ããåºã¦ãã¾ããã·ã³ã°ã«ã¯ã©ã¼ãã¼ã·ã§ã³(') ãæ¬å¼§ãè£å®ãã¦ããã¾ããä»ã¯ãã¼ãã«æ°ãï¼åããããã¾ãããããã¼ãã«æ°ãå¢ãã¦ããã®ã¹ãã¼ãã§è£å®ãã¦ããããªãã°ãããã¯ããã便å©ã§ããã
Analyze Dependency Matrix
ã©ã¤ã»ã³ã¹ãè²·ã£ãæã¯å ¨ç¶ç¥ããªãã£ãã®ã§ãããã¢ã¸ã¥ã¼ã«éã®ä¾åé¢ä¿ããããªãã¯è¡¨ç¤ºãã¦ãããæ©è½ãããã¾ããã
ã¡ã¤ã³ã¡ãã¥ã¼ãããAnalyzeã-ãAnalyze Dependency Matrix...ããé¸æãã¾ãã
ãSpecify Analyze Dependency Matrix Scopeããã¤ã¢ãã°ã表示ããã¾ãããOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
ã¢ã¸ã¥ã¼ã«ã®ä¾åé¢ä¿ã®ãããªãã¯ã¹è¡¨ã表示ããã¾ããä¸ã®ç»åã®å ´åãMailsendController ã¯ã©ã¹ã¯ MailsendFormValidator, MailsendService, MailsendForm ã¯ã©ã¹ã使ç¨ãã¦ãã ( uses ) ã¨ããæå³ã«ãªãã¾ãã
ãããªãã¯ã¹è¡¨ã®æ°åã表示ããã¦ããé¨åã§ã³ã³ããã¹ãã¡ãã¥ã¼ã表示ãããFind Usages for Dependenciesããé¸æãã¾ãã
Find View ã表示ããã使ç¨ããã¦ããé¨åã表示ããã¾ããFind View ä¸ã§ããã«ã¯ãªãã¯ããã¨ã½ã¼ã¹ãã¡ã¤ã«ã®è©²å½ç®æã表示ããã¾ãã
UML ã®ã¯ã©ã¹å³ä½ææ©è½
Project View ã§ã³ã³ããã¹ãã¡ãã¥ã¼ã表示ãã¦ãNewã-ãDiagramã-ãJava Class Diagramããé¸æãã¾ãã
ãCreate Java Class Diagramããã¤ã¢ãã°ã表示ããã¾ãããã¡ã¤ã«åãå ¥åãã¦ãOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
ã¯ã©ã¹ããã¤ã¢ã°ã©ã ä¸ã« Drag&Drop ãã¦ããã¤ã¢ãã°å·¦ä¸ã® Fields/Constructors/Methods/Properties/Inner Classes ãã表示ãããããã®ãã¯ãªãã¯ããå¾ããã¤ã¢ãã°ä¸å¤®ã®ãApply Current Layoutããã¿ã³ãã¯ãªãã¯ããã¨èªåæ´å½¢ãã¦ããã¾ãã