├── .gitignore ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── readme.md └── src ├── main ├── groovy │ └── com │ │ └── therealdanvega │ │ ├── GormdemoApplication.groovy │ │ ├── config │ │ └── WebMvcConfig.groovy │ │ ├── controller │ │ └── PostController.groovy │ │ ├── domain │ │ ├── Author.groovy │ │ └── Post.groovy │ │ └── service │ │ ├── PostService.groovy │ │ └── PostServiceImpl.groovy └── resources │ ├── application.properties │ └── data.sql └── test └── groovy └── com └── therealdanvega └── GormdemoApplicationTests.groovy /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | 9 | # Covers JetBrains IDEs: IntelliJ 10 | 11 | *.iml 12 | 13 | ## Directory-based project format: 14 | .idea/ 15 | 16 | ## File-based project format: 17 | *.ipr 18 | *.iws 19 | 20 | ## Plugin-specific files: 21 | 22 | # IntelliJ 23 | /out/ 24 | 25 | # JIRA plugin 26 | atlassian-ide-plugin.xml 27 | 28 | # Maven Based Projects 29 | target/ 30 | .mvn 31 | pom.xml.tag 32 | pom.xml.releaseBackup 33 | pom.xml.versionsBackup 34 | pom.xml.next 35 | release.properties 36 | dependency-reduced-pom.xml 37 | buildNumber.properties 38 | .mvn/timing.properties 39 | 40 | 41 | ###################### 42 | # Eclipse 43 | ###################### 44 | 45 | *.pydevproject 46 | .project 47 | .metadata 48 | bin/** 49 | tmp/** 50 | tmp/**/* 51 | *.tmp 52 | *.bak 53 | *.swp 54 | *~.nib 55 | local.properties 56 | .classpath 57 | .settings/ 58 | .loadpath 59 | /src/main/resources/rebel.xml 60 | # External tool builders 61 | .externalToolBuilders/ 62 | 63 | # Locally stored "Eclipse launch configurations" 64 | *.launch 65 | 66 | # CDT-specific 67 | .cproject 68 | 69 | # PDT-specific 70 | .buildpath 71 | 72 | ###################### 73 | # Gradle 74 | ###################### 75 | .gradle 76 | build/ 77 | 78 | # Ignore Gradle GUI config 79 | gradle-app.setting 80 | 81 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 82 | !gradle-wrapper.jar 83 | 84 | # Cache of project 85 | .gradletasknamecache -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.0.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 10 | } 11 | } 12 | 13 | apply plugin: 'groovy' 14 | apply plugin: 'eclipse' 15 | apply plugin: 'idea' 16 | apply plugin: 'spring-boot' 17 | 18 | jar { 19 | baseName = 'gormdemo' 20 | version = '0.0.1-SNAPSHOT' 21 | } 22 | sourceCompatibility = 1.8 23 | targetCompatibility = 1.8 24 | 25 | repositories { 26 | mavenCentral() 27 | } 28 | 29 | 30 | dependencies { 31 | compile('org.springframework.boot:spring-boot-starter-web') 32 | compile('org.codehaus.groovy:groovy') 33 | compile("org.grails:gorm-hibernate4-spring-boot:5.0.0.RC1") 34 | runtime('com.h2database:h2') 35 | testCompile('org.springframework.boot:spring-boot-starter-test') 36 | } 37 | 38 | 39 | eclipse { 40 | classpath { 41 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 42 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 43 | } 44 | } 45 | 46 | task wrapper(type: Wrapper) { 47 | gradleVersion = '2.7' 48 | } 49 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/gorm-spring-boot-demo/314f9c8c8f2c1d66d02628fecb1386702384c23d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Nov 23 22:21:31 EST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >&- 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >&- 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Using GORM in Spring Boot -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/GormdemoApplication.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega 2 | 3 | import org.springframework.boot.SpringApplication 4 | import org.springframework.boot.autoconfigure.SpringBootApplication 5 | import org.springframework.transaction.annotation.EnableTransactionManagement 6 | 7 | @SpringBootApplication 8 | @EnableTransactionManagement 9 | class GormdemoApplication { 10 | 11 | static void main(String[] args) { 12 | SpringApplication.run GormdemoApplication, args 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/config/WebMvcConfig.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.config 2 | 3 | import org.hibernate.SessionFactory 4 | import org.springframework.beans.factory.annotation.Autowired 5 | import org.springframework.context.annotation.Configuration 6 | import org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter 9 | 10 | //@Configuration 11 | class WebMvcConfig extends WebMvcConfigurerAdapter { 12 | 13 | @Autowired 14 | SessionFactory sessionFactory 15 | 16 | @Override 17 | void addInterceptors(InterceptorRegistry registry) { 18 | OpenSessionInViewInterceptor openSessionInViewInterceptor = new OpenSessionInViewInterceptor() 19 | openSessionInViewInterceptor.setSessionFactory(sessionFactory) 20 | registry.addWebRequestInterceptor( openSessionInViewInterceptor ) 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/controller/PostController.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.controller 2 | 3 | import com.therealdanvega.service.PostService 4 | import com.therealdanvega.service.PostServiceImpl 5 | import org.springframework.beans.factory.annotation.Autowired 6 | import org.springframework.web.bind.annotation.PathVariable 7 | import org.springframework.web.bind.annotation.RequestMapping 8 | import org.springframework.web.bind.annotation.RestController 9 | 10 | @RestController 11 | @RequestMapping("/posts") 12 | class PostController { 13 | 14 | PostService postService 15 | 16 | @Autowired 17 | PostController(PostService postService) { 18 | this.postService = postService 19 | } 20 | 21 | @RequestMapping("/") 22 | public String list(){ 23 | postService.list() 24 | } 25 | 26 | @RequestMapping("/{id}") 27 | public String get(@PathVariable(value = "id") int id){ 28 | postService.get(id) 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/domain/Author.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.domain 2 | 3 | import grails.persistence.Entity 4 | 5 | //@Entity 6 | class Author { 7 | 8 | String firstName 9 | String lastName 10 | String email 11 | 12 | //static hasMany = [posts:Post] 13 | 14 | static mapping = { 15 | //table 'authors' 16 | version false 17 | posts sort: 'postedOn', order: 'desc' 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/domain/Post.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.domain 2 | 3 | import grails.persistence.Entity 4 | 5 | @Entity 6 | class Post { 7 | 8 | String title 9 | String body 10 | String teaser 11 | String slug 12 | Date postedOn 13 | 14 | static mapping = { 15 | version false 16 | body type: 'text' 17 | teaser type: 'text' 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/service/PostService.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.service 2 | 3 | import com.therealdanvega.domain.Post 4 | 5 | interface PostService { 6 | 7 | ArrayList list() 8 | 9 | Post read(int id) 10 | } -------------------------------------------------------------------------------- /src/main/groovy/com/therealdanvega/service/PostServiceImpl.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega.service 2 | 3 | import com.therealdanvega.domain.Post 4 | import org.springframework.stereotype.Service 5 | import org.springframework.transaction.annotation.Transactional 6 | 7 | 8 | @Service('postService') 9 | @Transactional 10 | class PostServiceImpl implements PostService { 11 | 12 | @Override 13 | ArrayList list() { 14 | Post.list() 15 | } 16 | 17 | @Override 18 | Post read(int id) { 19 | Post.get(id) 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.h2.console.enabled=true 2 | spring.h2.console.path=/console 3 | spring.datasource.platform=h2 -------------------------------------------------------------------------------- /src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | SET @TEASER = '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis blandit eros. Morbi tincidunt varius sem, quis lacinia mauris ullamcorper a. Vivamus a ipsum libero. Donec lorem diam, varius ut metus ut, commodo hendrerit nulla. Sed tellus nisl, gravida vestibulum odio ut, ullamcorper scelerisque felis. In interdum pharetra odio, non fringilla diam. Nulla vitae velit quis nisl mattis pulvinar vel a tellus. In non nibh feugiat orci tincidunt iaculis ut at ipsum. Duis ac sodales nisl. Suspendisse vitae nibh dapibus tellus suscipit porttitor eget id orci. Morbi consectetur, nunc a posuere viverra, ex felis gravida ante, quis vulputate sapien dolor nec odio. Integer pretium felis dapibus nisi luctus vulputate eget eget ipsum. Vivamus cursus mollis sollicitudin. In dapibus, quam ac elementum condimentum, lorem mi laoreet lorem, eget interdum mi orci finibus erat. Proin porta vehicula blandit. Sed posuere ante ut dictum mattis.

'; 2 | SET @BODY = '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu arcu sit amet mauris egestas dignissim. Morbi non congue turpis. Curabitur elit sapien, mattis non diam vitae, lobortis pulvinar ex. Phasellus posuere in diam et luctus. Aliquam in magna consectetur, mollis turpis sed, placerat tortor. Integer sed lacinia diam. Duis sem lacus, placerat eu diam vitae, semper auctor sem. Quisque faucibus viverra sem id suscipit. Morbi maximus consectetur sem et aliquam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque egestas a ligula non ornare. Donec venenatis accumsan lectus, sed egestas eros facilisis vitae. Cras auctor non tellus sollicitudin rutrum. Curabitur finibus cursus leo, et tincidunt purus dignissim a. Sed imperdiet cursus sapien nec facilisis.

Mauris volutpat euismod finibus. Praesent ipsum massa, pellentesque a aliquam at, pretium id diam. Donec vel est sed dolor blandit laoreet ut nec ipsum. Suspendisse viverra hendrerit ligula quis volutpat. Cras vestibulum ornare finibus. Nam a tincidunt odio, vitae placerat massa. Vestibulum ullamcorper nunc viverra lacus luctus, quis placerat massa vehicula. In vulputate purus lorem, eget vulputate elit pulvinar eget. Nullam blandit tellus eu suscipit accumsan. Nam orci diam, maximus sed ornare quis, vulputate vitae sapien. Vivamus faucibus quam blandit mauris blandit, a commodo arcu semper.

Nam hendrerit est metus, ut condimentum ipsum fermentum vitae. Integer placerat, neque sit amet vehicula posuere, orci lacus congue ipsum, sed ultrices tortor leo sed erat. Cras quam elit, hendrerit et nunc eget, molestie pharetra quam. Suspendisse luctus quam et faucibus imperdiet. Sed varius mauris dui, ut lacinia nisl accumsan a. Vivamus sit amet diam egestas, viverra tellus a, iaculis velit. Praesent ac tellus ac neque auctor condimentum sagittis pellentesque massa. Aenean arcu est, rutrum vitae lacus aliquam, auctor consectetur enim. Proin magna eros, imperdiet id mauris ac, malesuada tincidunt nunc. Aliquam erat volutpat.

'; 3 | 4 | insert into author(id,first_name,last_name,email) values (1,'Dan','Vega','danvega@gmail.com'); 5 | insert into author(id,first_name,last_name,email) values (2,'John','Smith','johnsmith@gmail.com'); 6 | 7 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (1,'Spring Boot Rocks!','spring-boot-rocks',@TEASER,@BODY,1,CURRENT_TIMESTAMP); 8 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (2,'Spring Data Rocks!','spring-data-rocks',@TEASER,@BODY,1,CURRENT_TIMESTAMP); 9 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (3,'John Blog Post 1','john-blog-post-1',@TEASER,@BODY,2,CURRENT_TIMESTAMP); 10 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (4,'John Blog Post 2','john-blog-post-2',@TEASER,@BODY,2,CURRENT_TIMESTAMP); 11 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (5,'John Blog Post 3','john-blog-post-3',@TEASER,@BODY,2,CURRENT_TIMESTAMP); 12 | insert into Post(id,title,slug,teaser,body,author_id,posted_on) values (6,'Refactoring our Spring Data Project','refactoring-spring-data-project',@TEASER,@BODY,1,CURRENT_TIMESTAMP); -------------------------------------------------------------------------------- /src/test/groovy/com/therealdanvega/GormdemoApplicationTests.groovy: -------------------------------------------------------------------------------- 1 | package com.therealdanvega 2 | 3 | import org.junit.Test 4 | import org.junit.runner.RunWith 5 | import org.springframework.test.context.web.WebAppConfiguration; 6 | import org.springframework.boot.test.SpringApplicationConfiguration 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner 8 | 9 | @RunWith(SpringJUnit4ClassRunner) 10 | @SpringApplicationConfiguration(classes = GormdemoApplication) 11 | @WebAppConfiguration 12 | class GormdemoApplicationTests { 13 | 14 | @Test 15 | void contextLoads() { 16 | } 17 | 18 | } 19 | --------------------------------------------------------------------------------