Skip to content

Commit 4426711

Browse files
committed
Update README
1 parent 40629e8 commit 4426711

File tree

1 file changed

+49
-40
lines changed

1 file changed

+49
-40
lines changed

README.md

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
[![Apache 2.0 license](https://img.shields.io/badge/License-APACHE%202.0-green.svg?logo=APACHE&style=flat)](https://opensource.org/licenses/Apache-2.0)
33
[![Grace on X](https://img.shields.io/twitter/follow/graceframework?style=social)](https://twitter.com/graceframework)
44

5-
[![Groovy Version](https://img.shields.io/badge/Groovy-4.0.23-blue?style=flat&color=4298b8)](https://groovy-lang.org/releasenotes/groovy-4.0.html)
6-
[![Grace Version](https://img.shields.io/badge/Grace-2023.1.0-blue?style=flat&color=f49b06)](https://github.com/graceframework/grace-framework/releases/tag/v2023.1.0-M3)
7-
[![Spring Boot Version](https://img.shields.io/badge/Spring_Boot-3.3.5-blue?style=flat&color=6db33f)](https://github.com/spring-projects/spring-boot/releases)
5+
[![Groovy Version](https://img.shields.io/badge/Groovy-4.0.24-blue?style=flat&color=4298b8)](https://groovy-lang.org/releasenotes/groovy-4.0.html)
6+
[![Grace Version](https://img.shields.io/badge/Grace-2023.1.0-blue?style=flat&color=f49b06)](https://github.com/graceframework/grace-framework/releases/tag/v2023.1.0)
7+
[![Spring Boot Version](https://img.shields.io/badge/Spring_Boot-3.3.5-blue?style=flat&color=6db33f)](https://github.com/spring-projects/spring-boot/releases/tag/v3.3.5)
88

99

1010
# Spring Boot with Grace GORM
@@ -14,7 +14,7 @@ Learn how to build a Spring Boot application using GORM.
1414
### Versions
1515

1616
* Spring Boot 3.3.5
17-
* Grace Framework 2023.1.0-M3
17+
* Grace Framework 2023.1.0
1818

1919
### Adding Grace Dependencies
2020

@@ -56,7 +56,7 @@ dataSource:
5656
5757
### Creating Post Domain and GORM Service
5858
59-
Creating `Post.groovy` in `app/domain`,
59+
Creating `Post.groovy` and place it in `app/domain`,
6060

6161
```groovy
6262
class Post {
@@ -73,7 +73,10 @@ class Post {
7373
}
7474
```
7575

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`,
7780

7881
```groovy
7982
@grails.gorm.services.Service(Post)
@@ -101,16 +104,10 @@ postService.findAll()
101104

102105
### Running the App
103106

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.
111108

112109
```groovy
113-
@SpringBootApplication(exclude = [HibernateJpaAutoConfiguration, DataSourceAutoConfiguration, TransactionAutoConfiguration])
110+
@SpringBootApplication
114111
class GraceApplication implements CommandLineRunner {
115112
116113
@Autowired
@@ -141,6 +138,8 @@ class GraceApplication implements CommandLineRunner {
141138

142139
### Running the App
143140

141+
Staring the App by execute the following Gradle task,
142+
144143
```bash
145144
~/gs-spring-boot-gorm ./gradlew bootRun
146145
@@ -155,35 +154,36 @@ class GraceApplication implements CommandLineRunner {
155154
156155
:: Spring Boot :: (v3.3.5)
157156
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]
165-
2024-11-05T12:14:13.858+08:00 INFO 18006 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.31]
166-
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
170-
2024-11-05T12:14:14.308+08:00 INFO 18006 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
171-
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]
164+
2024-11-21T15:14:31.013+08:00 INFO 35305 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.33]
165+
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
169+
2024-11-21T15:14:31.439+08:00 INFO 35305 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
170+
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
172172
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))
173174
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)
180-
2024-11-05T12:14:15.015+08:00 DEBUG 18006 --- [ restartedMain] PluginsInfoApplicationContextInitializer :
175+
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)
180+
2024-11-21T15:14:32.181+08:00 DEBUG 35305 --- [ restartedMain] PluginsInfoApplicationContextInitializer :
181181
----------------------------------------------------------------------------------------------
182182
Order Plugin Name Plugin Version Enabled
183183
----------------------------------------------------------------------------------------------
184-
1 Core 2023.1.0-M3 Y
185-
2 DataSource 2023.1.0-M3 Y
186-
3 Hibernate 2023.1.0-M3 Y
184+
1 Core 2023.1.0 Y
185+
2 DataSource 2023.1.0 Y
186+
3 Hibernate 2023.1.0 Y
187187
----------------------------------------------------------------------------------------------
188188

189189
Prepare Sample Data >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -197,9 +197,12 @@ Hibernate: insert into post (id, version, title) values (default, ?, ?)
197197
Hibernate: insert into post (id, version, title) values (default, ?, ?)
198198
Hibernate: insert into post (id, version, title) values (default, ?, ?)
199199
Hibernate: insert into post (id, version, title) values (default, ?, ?)
200+
Hibernate: insert into post (id, version, title) values (default, ?, ?)
201+
Hibernate: insert into post (id, version, title) values (default, ?, ?)
202+
Hibernate: insert into comment (id, version, text) values (default, ?, ?)
200203

201204
Load All Posts >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
202-
Hibernate: select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.title as title3_0_0_ from post this_
205+
Hibernate: select this_.id as id1_1_0_, this_.version as version2_1_0_, this_.title as title3_1_0_ from post this_
203206
#1 Grace 2022.2.0 is released
204207
#2 Grace 2022.2.1 is released
205208
#3 Grace 2022.2.2 is released
@@ -209,7 +212,13 @@ Hibernate: select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.ti
209212
#7 Grace 2022.2.6 is released
210213
#8 Grace 2022.2.7 is released
211214
#9 Grace 2022.2.8 is released
212-
#10 What's new in Grace 2023.0.0?
215+
#10 Grace 2022.2.9 is released
216+
#11 What's new in Grace 2023.0.0?
217+
#12 Grace 2023.1.0 is also available now!
218+
219+
Load All Comments >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
220+
Hibernate: select comment0_.id as id1_0_, comment0_.version as version2_0_, comment0_.text as text3_0_ from comment comment0_
221+
Wow, Grace is awesome!
213222
```
214223

215224
# Links

0 commit comments

Comments
 (0)