Skip to content

Commit

Permalink
Merge pull request #56 from matrei/matrei/update-cleanup
Browse files Browse the repository at this point in the history
Update and cleanup for Grails 6/Java 11
  • Loading branch information
puneetbehl authored Nov 23, 2023
2 parents 48c085a + bb7421f commit 29013da
Show file tree
Hide file tree
Showing 132 changed files with 2,502 additions and 3,076 deletions.
9 changes: 0 additions & 9 deletions examples/pubsub-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,18 @@ dependencies {
implementation 'org.grails:grails-plugin-url-mappings'
implementation 'org.grails:grails-web-boot'

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

implementation 'org.springframework.boot:spring-boot-autoconfigure'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-logging'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'

implementation 'org.hibernate:hibernate-core'
implementation 'org.hibernate:hibernate-ehcache'

console 'org.grails:grails-console'

runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'

testImplementation 'io.micronaut:micronaut-http-client'
testImplementation 'io.micronaut:micronaut-inject-groovy'
testImplementation 'org.grails:grails-gorm-testing-support'
testImplementation 'org.grails:grails-web-testing-support'

}
112 changes: 24 additions & 88 deletions examples/pubsub-demo/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
---
grails:
profile: rest-api
codegen:
defaultPackage: pubsub.demo
spring:
transactionManagement:
proxies: false
gorm:
# Whether to autowire entities.
# Disabled by default for performance reasons.
autowire: false
reactor:
# Whether to translate GORM events into Reactor events
# Disabled by default for performance reasons
events: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
main:
banner-mode: "off"
groovy:
template:
check-template-location: false

# Spring Actuator Endpoints are Disabled by Default
endpoints:
enabled: false
jmx:
enabled: true

---
grails:
views:
default:
codec: html
gorm:
reactor:
events: false
mime:
disable:
accept:
Expand All @@ -45,72 +21,32 @@ grails:
- Trident
types:
json:
- application/json
- text/json
- application/json
- text/json
hal:
- application/hal+json
- application/hal+xml
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
- text/xml
- application/xml
atom: application/atom+xml
css: text/css
csv: text/csv
js: text/javascript
rss: application/rss+xml
text: text/plain
all: '*/*'
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8

---
hibernate:
cache:
queries: false
use_second_level_cache: true
use_query_cache: false
region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

all: '*/*'
dataSource:
pooled: true
jmxExport: true
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
password:

environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: none
url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
password: ''
pooled: true
jmxExport: true
hibernate:
hbm2ddl:
auto: update
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package pubsub.demo

import grails.core.GrailsApplication
import grails.util.Environment
import grails.plugins.*
import grails.plugins.GrailsPluginManager
import grails.plugins.PluginManagerAware
import groovy.transform.CompileStatic

@CompileStatic
class ApplicationController implements PluginManagerAware {

GrailsApplication grailsApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package pubsub.demo

import groovy.transform.CompileStatic

@CompileStatic
class SumController {
static responseFormats = ['json', 'xml']

@SuppressWarnings('unused')
static responseFormats = ['json', 'xml']

SumService sumService
TotalService totalService

def index() {
int sum = sumService.sum(1, 2)
int sum = sumService.sum 1, 2
int total = totalService.accumulatedTotal
render "sum: $sum, total: $total"
render"sum: $sum, total: $total"
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
package pubsub.demo

import groovy.transform.CompileStatic

import static grails.async.web.WebPromises.*

@CompileStatic
class TaskController {

@SuppressWarnings('unused')
static responseFormats = ['json', 'xml']

def index() {
task {
sleep 1000
render "good"
render 'good'
}
}

def error() {
task {
sleep(1000)
throw new RuntimeException("bad")
sleep 1000
throw new RuntimeException('bad')
}.onError {
render text:"error occured",status: 500
render text: 'error occurred', status: 500
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package pubsub.demo

import grails.compiler.GrailsCompileStatic

/**
* Created by graemerocher on 18/05/2017.
*/
@GrailsCompileStatic
class Author {

String name

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package pubsub.demo

import grails.compiler.GrailsCompileStatic

@GrailsCompileStatic
class Book {

String title

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package pubsub.demo

import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
import groovy.transform.CompileStatic
import org.springframework.context.annotation.ComponentScan

@ComponentScan
@CompileStatic
class Application extends GrailsAutoConfiguration {
static void main(String[] args) {
GrailsApp.run(Application, args)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package pubsub.demo

import grails.events.annotation.Publisher
import grails.gorm.transactions.Transactional
import groovy.transform.CompileStatic

@CompileStatic
class SumService {

@Publisher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ package pubsub.demo

import grails.events.Event
import grails.events.annotation.Subscriber
import groovy.transform.CompileStatic

@CompileStatic
class TotalService {

int accumulatedTotal = 0

@Subscriber
@SuppressWarnings('unused')
void onSum(int total) {
accumulatedTotal += total
}

@Subscriber
@SuppressWarnings('unused')
void onSum(Event<Integer> event) {
println "Event $event.id"
println "Data $event.data"
println "Parameters $event.parameters"
}

@Subscriber
@SuppressWarnings('unused')
void onSum(Throwable error) {
println "Oh NO!!! $error.message"
}
Expand Down

This file was deleted.

Loading

0 comments on commit 29013da

Please sign in to comment.