/* Ċ Ġ* ĠThe ĠMIT ĠLicense Ġ( MIT ) Ċ Ġ* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 2 1 ĠJon ĠB rule Ġ< br ule jr @ gmail . com > Ċ Ġ* Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ċ Ġ* Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ġ( the Ġ" Software "), Ġto Ġdeal Ċ Ġ* Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ċ Ġ* Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ċ Ġ* Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ċ Ġ* Ġfurnished Ġto Ġdo Ġso , Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ċ Ġ* Ġall Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR Ċ Ġ* ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF ĠMERCHANTABILITY , Ċ Ġ* ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE Ċ Ġ* ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER Ċ Ġ* ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , Ċ Ġ* ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN ĠTHE Ċ Ġ* ĠSOFTWARE . Ċ Ġ*/ Ċ package Ġio . j rb . labs . doc asm . config Ċ Ċ import Ġio . j rb . labs . common . h 2 . H 2 Console Server Ċ import Ġio . j rb . labs . doc asm . service . Document Service Ċ import Ġio . j rb . labs . doc asm . service . Section Service Ċ import Ġio . r 2 dbc . spi . ConnectionFactory Ċ import Ġorg . springframework . beans . factory . annotation . Qualifier Ċ import Ġorg . springframework . beans . factory . annotation . Value Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . context . annotation . Profile Ċ import Ġorg . springframework . core . io . Class Path Resource Ċ import Ġorg . springframework . r 2 dbc . connection . R 2 dbc Transaction Manager Ċ import Ġorg . springframework . r 2 dbc . connection . init . Composite Database Pop ulator Ċ import Ġorg . springframework . r 2 dbc . connection . init . ConnectionFactory Initializer Ċ import Ġorg . springframework . r 2 dbc . connection . init . Resource Database Pop ulator Ċ import Ġorg . springframework . r 2 dbc . core . Database Client Ċ import Ġorg . springframework . transaction . Reactive Transaction Manager Ċ Ċ @ Configuration Ċ class ĠDatabase Java Config ( db : ĠDatabase Client ) Ġ{ ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġdemo Initializer ( document Service : ĠDocument Service , Ġsection Service : ĠSection Service ) Ġ= ĊĠĠĠĠĠĠĠ ĠDemo Initializer ( document Service , Ġsection Service ) ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġschema Initializer (@ Qualifier (" connection Factory ") Ġconnection Factory : ĠConnection Factory ?): ĠConnection Factory Initializer ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinitializer Ġ= ĠConnection Factory Initializer () ĊĠĠĠĠĠĠĠ Ġinitializer . set ConnectionFactory ( connection Factory !! ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpop ulator Ġ= ĠComposite Database Pop ulator () ĊĠĠĠĠĠĠĠ Ġpop ulator . add Pop ulators ( Resource Database Pop ulator ( Class Path Resource (" schema . sql "))) ĊĠĠĠĠĠĠĠ Ġinitializer . set Database Pop ulator ( pop ulator ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġinitializer ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġtransaction Manager (@ Qualifier (" connection Factory ") Ġconnection Factory : ĠConnection Factory ): ĠReactive Transaction Manager Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠR 2 dbc Transaction Manager ( connection Factory ); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġ@ Profile (" local ") ĊĠĠĠ Ġfun Ġh 2 Console Server (@ Value ("\ ${ h 2 . console . port }") Ġconsole Port : ĠInt ): ĠH 2 Console Server ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠH 2 Console Server ( console Port ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ