You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -14,7 +14,7 @@ Learn how to build a Spring Boot application using GORM.
14
14
### Versions
15
15
16
16
* Spring Boot 3.3.5
17
-
* Grace Framework 2023.1.0-M3
17
+
* Grace Framework 2023.1.0
18
18
19
19
### Adding Grace Dependencies
20
20
@@ -56,7 +56,7 @@ dataSource:
56
56
57
57
### Creating Post Domain and GORM Service
58
58
59
-
Creating `Post.groovy` in `app/domain`,
59
+
Creating `Post.groovy` and place it in `app/domain`,
60
60
61
61
```groovy
62
62
class Post {
@@ -73,7 +73,10 @@ class Post {
73
73
}
74
74
```
75
75
76
-
Creating `PostService.groovy` in `app/services`,
76
+
> [!NOTE]
77
+
> In Grace 2023.1.0, you can also place GORM Entity in the `src/main/groovy`.
78
+
79
+
Creating `PostService.groovy` and place it in `app/services`,
77
80
78
81
```groovy
79
82
@grails.gorm.services.Service(Post)
@@ -101,16 +104,10 @@ postService.findAll()
101
104
102
105
### Running the App
103
106
104
-
Staring the App by execute the following Gradle task,
105
-
106
-
```bash
107
-
./gradlew bootRun
108
-
```
109
-
110
-
In the `src/main/groovy/grace/guides/GraceApplication`, remember that, exculding the AutoConfigurations, `HibernateJpaAutoConfiguration`, `DataSourceAutoConfiguration`, `TransactionAutoConfiguration` in `GraceApplication`.
107
+
In the `src/main/groovy/grace/guides/GraceApplication`, if you use Grace before `2023.1.0`, remember that, exculding the AutoConfigurations, `HibernateJpaAutoConfiguration`, `DataSourceAutoConfiguration`, `TransactionAutoConfiguration` in `GraceApplication`, now in Grace `2023.1.0`, there is no need to do this.
class GraceApplication implements CommandLineRunner {
115
112
116
113
@Autowired
@@ -141,6 +138,8 @@ class GraceApplication implements CommandLineRunner {
141
138
142
139
### Running the App
143
140
141
+
Staring the App by execute the following Gradle task,
142
+
144
143
```bash
145
144
~/gs-spring-boot-gorm ./gradlew bootRun
146
145
@@ -155,35 +154,36 @@ class GraceApplication implements CommandLineRunner {
155
154
156
155
:: Spring Boot :: (v3.3.5)
157
156
158
-
2024-11-05T12:14:13.189+08:00 INFO 18006 --- [ restartedMain] grace.guides.GraceApplication : Starting GraceApplication using Java 17.0.12 with PID 18006 (/Users/rain/Development/github/grace/grace-guides/gs-spring-boot-gorm/build/classes/groovy/main started by rain in /Users/rain/Development/github/grace/grace-guides/gs-spring-boot-gorm)
159
-
2024-11-05T12:14:13.190+08:00 INFO 18006 --- [ restartedMain] grace.guides.GraceApplication : No active profile set, falling back to 1 default profile: "default"
160
-
2024-11-05T12:14:13.209+08:00 INFO 18006 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
161
-
2024-11-05T12:14:13.209+08:00 INFO 18006 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
162
-
2024-11-05T12:14:13.631+08:00 INFO 18006 --- [ restartedMain] g.plugins.DefaultGrailsPluginManager : Total 3 plugins loaded successfully, take in 37 ms
163
-
2024-11-05T12:14:13.850+08:00 INFO 18006 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
164
-
2024-11-05T12:14:13.857+08:00 INFO 18006 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-11-05T12:14:13.893+08:00 INFO 18006 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
167
-
2024-11-05T12:14:13.893+08:00 INFO 18006 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 684 ms
168
-
2024-11-05T12:14:14.058+08:00 INFO 18006 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:file:./build/boot_dev'
169
-
2024-11-05T12:14:14.205+08:00 INFO 18006 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final
2024-11-05T12:14:14.350+08:00 INFO 18006 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
157
+
2024-11-21T15:14:30.366+08:00 INFO 35305 --- [ restartedMain] grace.guides.GraceApplication : Starting GraceApplication using Java 17.0.12 with PID 35305 (/Users/rain/Development/github/grace/grace-guides/gs-spring-boot-gorm/build/classes/groovy/main started by rain in /Users/rain/Development/github/grace/grace-guides/gs-spring-boot-gorm)
158
+
2024-11-21T15:14:30.367+08:00 INFO 35305 --- [ restartedMain] grace.guides.GraceApplication : No active profile set, falling back to 1 default profile: "default"
159
+
2024-11-21T15:14:30.385+08:00 INFO 35305 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
160
+
2024-11-21T15:14:30.385+08:00 INFO 35305 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
161
+
2024-11-21T15:14:30.791+08:00 INFO 35305 --- [ restartedMain] g.plugins.DefaultGrailsPluginManager : Total 3 plugins loaded successfully, take in 36 ms
162
+
2024-11-21T15:14:31.007+08:00 INFO 35305 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
163
+
2024-11-21T15:14:31.013+08:00 INFO 35305 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-11-21T15:14:31.042+08:00 INFO 35305 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
166
+
2024-11-21T15:14:31.043+08:00 INFO 35305 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 657 ms
167
+
2024-11-21T15:14:31.201+08:00 INFO 35305 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:file:./build/boot_dev'
168
+
2024-11-21T15:14:31.344+08:00 INFO 35305 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final
2024-11-21T15:14:31.478+08:00 INFO 35305 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
171
+
Hibernate: drop table if exists comment CASCADE
172
172
Hibernate: drop table if exists post CASCADE
173
+
Hibernate: create table comment (id bigint generated by default as identity, version bigint not null, text varchar(255) not null, primary key (id))
173
174
Hibernate: create table post (id bigint generated by default as identity, version bigint not null, title varchar(255) not null, primary key (id))
174
-
2024-11-05T12:14:14.725+08:00 WARN 18006 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
175
-
2024-11-05T12:14:14.902+08:00 WARN 18006 --- [ restartedMain] .b.a.g.t.GroovyTemplateAutoConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Groovy configuration, or set spring.groovy.template.check-template-location=false)
176
-
2024-11-05T12:14:14.949+08:00 INFO 18006 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
177
-
2024-11-05T12:14:14.956+08:00 INFO 18006 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint beneath base path '/actuator'
178
-
2024-11-05T12:14:14.995+08:00 INFO 18006 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
179
-
2024-11-05T12:14:15.006+08:00 INFO 18006 --- [ restartedMain] grace.guides.GraceApplication : Started GraceApplication in 1.989 seconds (process running for 2.332)
2024-11-21T15:14:32.058+08:00 WARN 35305 --- [ restartedMain] .b.a.g.t.GroovyTemplateAutoConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Groovy configuration, or set spring.groovy.template.check-template-location=false)
176
+
2024-11-21T15:14:32.115+08:00 INFO 35305 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
177
+
2024-11-21T15:14:32.123+08:00 INFO 35305 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint beneath base path '/actuator'
178
+
2024-11-21T15:14:32.161+08:00 INFO 35305 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
179
+
2024-11-21T15:14:32.172+08:00 INFO 35305 --- [ restartedMain] grace.guides.GraceApplication : Started GraceApplication in 1.971 seconds (process running for 2.331)
0 commit comments