Skip to content

Commit 29013da

Browse files
authored
Merge pull request #56 from matrei/matrei/update-cleanup
Update and cleanup for Grails 6/Java 11
2 parents 48c085a + bb7421f commit 29013da

File tree

132 files changed

+2502
-3076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2502
-3076
lines changed

examples/pubsub-demo/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,18 @@ dependencies {
2121
implementation 'org.grails:grails-plugin-url-mappings'
2222
implementation 'org.grails:grails-web-boot'
2323

24-
implementation 'org.grails.plugins:cache', { exclude module: 'asset-pipeline-grails' }
2524
implementation 'org.grails.plugins:hibernate5'
2625
implementation 'org.grails.plugins:views-json'
27-
implementation 'org.grails.plugins:views-json-templates'
2826

2927
implementation 'org.springframework.boot:spring-boot-autoconfigure'
3028
implementation 'org.springframework.boot:spring-boot-starter'
3129
implementation 'org.springframework.boot:spring-boot-starter-logging'
3230
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
3331

34-
implementation 'org.hibernate:hibernate-core'
35-
implementation 'org.hibernate:hibernate-ehcache'
36-
37-
console 'org.grails:grails-console'
38-
3932
runtimeOnly 'com.h2database:h2'
4033
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
4134

4235
testImplementation 'io.micronaut:micronaut-http-client'
43-
testImplementation 'io.micronaut:micronaut-inject-groovy'
44-
testImplementation 'org.grails:grails-gorm-testing-support'
4536
testImplementation 'org.grails:grails-web-testing-support'
4637

4738
}
Lines changed: 24 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
1-
---
2-
grails:
3-
profile: rest-api
4-
codegen:
5-
defaultPackage: pubsub.demo
6-
spring:
7-
transactionManagement:
8-
proxies: false
9-
gorm:
10-
# Whether to autowire entities.
11-
# Disabled by default for performance reasons.
12-
autowire: false
13-
reactor:
14-
# Whether to translate GORM events into Reactor events
15-
# Disabled by default for performance reasons
16-
events: false
171
info:
182
app:
193
name: '@info.app.name@'
204
version: '@info.app.version@'
215
grailsVersion: '@info.app.grailsVersion@'
22-
spring:
23-
main:
24-
banner-mode: "off"
25-
groovy:
26-
template:
27-
check-template-location: false
28-
29-
# Spring Actuator Endpoints are Disabled by Default
30-
endpoints:
31-
enabled: false
32-
jmx:
33-
enabled: true
34-
35-
---
366
grails:
7+
views:
8+
default:
9+
codec: html
10+
gorm:
11+
reactor:
12+
events: false
3713
mime:
3814
disable:
3915
accept:
@@ -45,72 +21,32 @@ grails:
4521
- Trident
4622
types:
4723
json:
48-
- application/json
49-
- text/json
24+
- application/json
25+
- text/json
5026
hal:
51-
- application/hal+json
52-
- application/hal+xml
27+
- application/hal+json
28+
- application/hal+xml
5329
xml:
54-
- text/xml
55-
- application/xml
30+
- text/xml
31+
- application/xml
5632
atom: application/atom+xml
5733
css: text/css
5834
csv: text/csv
5935
js: text/javascript
6036
rss: application/rss+xml
6137
text: text/plain
62-
all: '*/*'
63-
urlmapping:
64-
cache:
65-
maxsize: 1000
66-
controllers:
67-
defaultScope: singleton
68-
converters:
69-
encoding: UTF-8
70-
71-
---
72-
hibernate:
73-
cache:
74-
queries: false
75-
use_second_level_cache: true
76-
use_query_cache: false
77-
region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
78-
38+
all: '*/*'
7939
dataSource:
80-
pooled: true
81-
jmxExport: true
40+
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
8241
driverClassName: org.h2.Driver
8342
username: sa
84-
password:
85-
86-
environments:
87-
development:
88-
dataSource:
89-
dbCreate: create-drop
90-
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
91-
test:
92-
dataSource:
93-
dbCreate: update
94-
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
95-
production:
96-
dataSource:
97-
dbCreate: none
98-
url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
99-
properties:
100-
jmxEnabled: true
101-
initialSize: 5
102-
maxActive: 50
103-
minIdle: 5
104-
maxIdle: 25
105-
maxWait: 10000
106-
maxAge: 600000
107-
timeBetweenEvictionRunsMillis: 5000
108-
minEvictableIdleTimeMillis: 60000
109-
validationQuery: SELECT 1
110-
validationQueryTimeout: 3
111-
validationInterval: 15000
112-
testOnBorrow: true
113-
testWhileIdle: true
114-
testOnReturn: false
115-
jdbcInterceptors: ConnectionState
116-
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
43+
password: ''
44+
pooled: true
45+
jmxExport: true
46+
hibernate:
47+
hbm2ddl:
48+
auto: update
49+
cache:
50+
queries: false
51+
use_second_level_cache: false
52+
use_query_cache: false

examples/pubsub-demo/grails-app/controllers/pubsub/demo/ApplicationController.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package pubsub.demo
22

33
import grails.core.GrailsApplication
4-
import grails.util.Environment
5-
import grails.plugins.*
4+
import grails.plugins.GrailsPluginManager
5+
import grails.plugins.PluginManagerAware
6+
import groovy.transform.CompileStatic
67

8+
@CompileStatic
79
class ApplicationController implements PluginManagerAware {
810

911
GrailsApplication grailsApplication
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
package pubsub.demo
22

3+
import groovy.transform.CompileStatic
34

5+
@CompileStatic
46
class SumController {
5-
static responseFormats = ['json', 'xml']
7+
8+
@SuppressWarnings('unused')
9+
static responseFormats = ['json', 'xml']
610

711
SumService sumService
812
TotalService totalService
913

1014
def index() {
11-
int sum = sumService.sum(1, 2)
15+
int sum = sumService.sum 1, 2
1216
int total = totalService.accumulatedTotal
13-
render "sum: $sum, total: $total"
17+
render"sum: $sum, total: $total"
1418
}
1519
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
package pubsub.demo
22

3+
import groovy.transform.CompileStatic
34

45
import static grails.async.web.WebPromises.*
56

7+
@CompileStatic
68
class TaskController {
9+
10+
@SuppressWarnings('unused')
711
static responseFormats = ['json', 'xml']
812

913
def index() {
1014
task {
1115
sleep 1000
12-
render "good"
16+
render 'good'
1317
}
1418
}
1519

1620
def error() {
1721
task {
18-
sleep(1000)
19-
throw new RuntimeException("bad")
22+
sleep 1000
23+
throw new RuntimeException('bad')
2024
}.onError {
21-
render text:"error occured",status: 500
25+
render text: 'error occurred', status: 500
2226
}
2327
}
2428
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package pubsub.demo
22

3+
import grails.compiler.GrailsCompileStatic
4+
35
/**
46
* Created by graemerocher on 18/05/2017.
57
*/
8+
@GrailsCompileStatic
69
class Author {
10+
711
String name
12+
813
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package pubsub.demo
22

3+
import grails.compiler.GrailsCompileStatic
4+
5+
@GrailsCompileStatic
36
class Book {
7+
48
String title
9+
510
}

examples/pubsub-demo/grails-app/init/pubsub/demo/Application.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package pubsub.demo
22

33
import grails.boot.GrailsApp
44
import grails.boot.config.GrailsAutoConfiguration
5+
import groovy.transform.CompileStatic
56
import org.springframework.context.annotation.ComponentScan
67

78
@ComponentScan
9+
@CompileStatic
810
class Application extends GrailsAutoConfiguration {
911
static void main(String[] args) {
1012
GrailsApp.run(Application, args)

examples/pubsub-demo/grails-app/init/pubsub/demo/BootStrap.groovy

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/pubsub-demo/grails-app/services/pubsub/demo/SumService.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package pubsub.demo
22

33
import grails.events.annotation.Publisher
44
import grails.gorm.transactions.Transactional
5+
import groovy.transform.CompileStatic
56

7+
@CompileStatic
68
class SumService {
79

810
@Publisher

0 commit comments

Comments
 (0)