Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://github.com/grails/grails-core/issues/11367 #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions micronaut/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
compile "org.hibernate:hibernate-core:5.4.0.Final"
compile "org.grails.plugins:gsp"
compileOnly "io.micronaut:micronaut-inject-groovy"
compile 'io.micronaut.configuration:micronaut-redis-lettuce:1.1.0'
console "org.grails:grails-console"
profile "org.grails.profiles:web"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
Expand All @@ -71,6 +72,7 @@ dependencies {
testCompile "org.seleniumhq.selenium:selenium-support:3.14.0"
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.14.0"
testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.14.0"
testCompile "com.github.kstyrc:embedded-redis:0.6"
}

bootRun {
Expand Down
2 changes: 2 additions & 0 deletions micronaut/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ environments:
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
redis:
enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package micronaut
import bean.injection.NamedService
import bean.injection.Qualified
import org.springframework.beans.factory.annotation.Autowired

import javax.inject.Inject
import io.lettuce.core.api.StatefulRedisConnection
import org.springframework.beans.factory.annotation.Qualifier
import javax.inject.Named

class BeanInjectionService {
Expand All @@ -26,4 +26,9 @@ class BeanInjectionService {

@Autowired
NamedService namedService

// TODO: it should not be needed to add this Qualifier
@Qualifier("io.lettuce.core.api.StatefulRedisConnection(Primary)")
@Autowired
StatefulRedisConnection<String, String> statefulRedisConnection
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@ package micronaut
import grails.testing.mixin.integration.Integration
import org.springframework.beans.factory.annotation.Autowired
import spock.lang.Specification
import redis.embedded.RedisServer

@Integration
class BeanInjectionServiceSpec extends Specification {

static RedisServer redisServer = new RedisServer(6379)

def setupSpec() {
redisServer.start()
}

def cleanupSpec() {
if(redisServer) {
redisServer.stop()
}
}

@Autowired
BeanInjectionService service

Expand All @@ -17,5 +30,6 @@ class BeanInjectionServiceSpec extends Specification {
service.namedService3.name == "special"
service.namedService4.name == "qualified"
service.namedService.name == "primary"
service.statefulRedisConnection.sync().ping() == 'PONG'
}
}