Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless
arguments: build
publish:
if: github.event_name == 'push'
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ buildscript {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.grails.plugins:views-gradle:$viewsGradleVersion"
classpath "org.asciidoctor:asciidoctor-gradle-jvm:$asciidoctorGradleVersion"
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:$webdriverBinariesPluginVersion"
}
}

Expand Down Expand Up @@ -90,7 +89,6 @@ subprojects { Project subproject ->
if (subproject.name != "examples-grails-data-service") {
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.github.erdi.webdriver-binaries"
}
}

Expand Down
50 changes: 24 additions & 26 deletions examples/grails-data-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
group "examples"
plugins {
id 'groovy'
id 'org.grails.grails-web'
id 'org.grails.plugins.views-json'
}


apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"
apply plugin: 'java'
version = rootProject.version
group = 'examples'

dependencies {
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-dependencies"
implementation "org.grails:grails-plugin-codecs"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-datasource"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:events"
implementation project(":grails-plugin")
implementation "org.hibernate:hibernate-core-jakarta:$hibernateVersion"
implementation "org.grails.plugins:views-json"
implementation "org.grails.plugins:views-json-templates"
implementation "org.grails.plugins:spring-security-rest:$grailsSpringSecurityRestVersion"
profile "org.grails.profiles:rest-api"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
testImplementation "org.grails:grails-gorm-testing-support:$testingSupportVersion"
testImplementation "org.grails:grails-web-testing-support:$testingSupportVersion"

implementation project(':grails-plugin')
implementation 'org.grails:grails-core'
implementation 'org.grails.plugins:views-json'

runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.zaxxer:HikariCP'
runtimeOnly 'org.grails:grails-plugin-databinding'
runtimeOnly 'org.grails:grails-plugin-i18n'
runtimeOnly 'org.grails:grails-plugin-services'
runtimeOnly 'org.grails:grails-plugin-url-mappings'
runtimeOnly 'org.springframework.boot:spring-boot-autoconfigure'
runtimeOnly 'org.springframework.boot:spring-boot-starter-logging'
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'

integrationTestImplementation 'org.grails:grails-testing-support'
}
14 changes: 0 additions & 14 deletions examples/grails-data-service/grails-app/conf/application.groovy

This file was deleted.

171 changes: 58 additions & 113 deletions examples/grails-data-service/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,121 +1,66 @@
grails:
gorm:
multiTenancy:
mode: DISCRIMINATOR
tenantResolverClass: org.grails.datastore.mapping.multitenancy.web.SessionTenantResolver
---
grails:
profile: rest-api
codegen:
defaultPackage: example
gorm:
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:
jmx:
unique-names: true
main:
banner-mode: "off"
groovy:
template:
check-template-location: false
devtools:
restart:
additional-exclude:
- '*.gsp'
- '**/*.gsp'
- '*.gson'
- '**/*.gson'
- 'logback.groovy'
- '*.properties'
management:
endpoints:
enabled-by-default: false

app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
json:
- application/json
- text/json
hal:
- application/hal+json
- application/hal+xml
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

profile: rest-api
codegen:
defaultPackage: example
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
json:
- application/json
- text/json
hal:
- application/hal+json
- application/hal+xml
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
converters:
encoding: UTF-8
---
hibernate:
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
cache:
queries: false
use_second_level_cache: false
use_query_cache: false
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password: ''
pooled: true
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
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
2 changes: 1 addition & 1 deletion examples/grails-data-service/grails-app/conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>'%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex'</pattern>
<pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex</pattern>
</encoder>
</appender>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import example.LoginAuthenticationSucessHandler
import example.ClassUsingAService
import example.TestBean

// Place your Spring DSL code here
beans = {

restAuthenticationSuccessHandler(LoginAuthenticationSucessHandler) {
classUsingAService(ClassUsingAService) {
testService = ref('testService')
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package example

import grails.gorm.transactions.TransactionService

class TestService {

LibraryService libraryService
TransactionService transactionService

Boolean testDataService(Serializable id) {
libraryService.bookExists(id)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package example

import grails.testing.mixin.integration.Integration
import spock.lang.Issue
import spock.lang.Specification

@Integration
class ServiceInjectionSpec extends Specification {

ClassUsingAService classUsingAService

@Issue('https://github.com/grails/gorm-hibernate5/issues/202')
void 'data-service is injected correctly'() {
when:
classUsingAService.doSomethingWithTheService()

then:
noExceptionThrown()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ class TestServiceSpec extends Specification {

TestService testService
TestBean testBean
ClassUsingAService classUsingAService

@Autowired
List<BookService> bookServiceList

void "test data-service is loaded correctly"() {
when:
classUsingAService.doSomethingWithTheService()

and:
testService.testDataService()

then:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package example

import groovy.transform.CompileStatic

@CompileStatic
class ClassUsingAService {

TestService testService

void doSomethingWithTheService() {
testService.testDataService(1l)
}

}
Loading
Loading