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

Gorm failures for Micronaut 3 #366

Closed
sdelamo opened this issue Jul 13, 2021 · 0 comments
Closed

Gorm failures for Micronaut 3 #366

sdelamo opened this issue Jul 13, 2021 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@sdelamo
Copy link
Contributor

sdelamo commented Jul 13, 2021

In Micronaut 2.5.x such a Data service:

package example.micronaut

import grails.gorm.multitenancy.WithoutTenant
import grails.gorm.multitenancy.CurrentTenant
import grails.gorm.services.Service

@CurrentTenant // <1>
@Service(Book) // <2>
interface BookService {
    Book save(String title)
    List<Book> findAll()

    @WithoutTenant
    void delete(Serializable id)

}

was registered as a singleton. In Micronaut 3 it fails with:

Failed to inject value for parameter [bookService] of class: example.micronaut.BookControllerSpec

Message: No bean of type [example.micronaut.BookService] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Path Taken: BookControllerSpec.setBookService([BookService bookService])```

Trying the work around of annotating the data service with `jakarta.inject.Singleton` it fails with: 


No GORM implementations configured. Ensure GORM has been initialized correctly
java.lang.IllegalStateException: No GORM implementations configured. Ensure GORM has been initialized correctly
at org.grails.datastore.gorm.GormEnhancer.findSingleDatastore(GormEnhancer.groovy:378)
at grails.gorm.multitenancy.Tenants.withId(Tenants.groovy:166)
at example.micronaut.BookControllerSpec.test hello world response(BookControllerSpec.groovy:25)


This affects two guides: 

-  micronaut-multitenancy-propagation-gradle-groovy
-   micronaut-database-authentication-provider


You can generate the sample projects and test script with: 

`./gradlew -Dmicronaut.guide=micronaut-multitenancy-propagation build;`
- 
@sdelamo sdelamo added this to the 3.0.0 milestone Jul 13, 2021
@sdelamo sdelamo added the bug Something isn't working label Jul 13, 2021
sdelamo added a commit that referenced this issue Jul 13, 2021
sdelamo added a commit that referenced this issue Jul 13, 2021
* Revert "ignore gorm tests (#360)"

This reverts commit 6501790.

* annotate Gorm entities with @introspected

Close: #366
@sdelamo sdelamo closed this as completed Jul 13, 2021
sdelamo added a commit that referenced this issue Aug 18, 2021
* change version to 3.0.0-SNAPSHOT

* uses Jakarta annotation in 3.0.x branch (#303)

* replace javax.inject.Inject with jakarta

* replace javax.inject.Singleton with jakarta

* for single guide don't execute every test

* gradle task to replace javax.inject imports

* fix build

* Replace usage of deprecated methods (#350)

* Use undeprecated method

* remove deprecated method

* pass null to validateToken

* add import to custom replace task javax.inject (#365)

* fetch annotation value using javax.inject.Named (#364)

see: micronaut-projects/micronaut-core#5743

* disable cookie-secure for dev and test (#362)

* remove @eventlistener from persistToken (#361)

* ignore graphql tests (#363)

* ignore gorm tests (#360)

* Annotated gorm entities as introspected (#369)

* Revert "ignore gorm tests (#360)"

This reverts commit 6501790.

* annotate Gorm entities with @introspected

Close: #366

* Reactor (#376)

* rxjava2 to reactor

* Update BookCatalogueClientStub.groovy

* remove MVCC config

* blockFirst not blockingFirst

* Use Mono.from

* add reactor-core dependency

* add args to Micronaut.run in groovy

* guides fixes for reactor move

* fix reactor

* fix kotlin function guide

* merge master

* replace @SingleResult Publisher with Mono

See: #393

* fix jakarta imports

* Update security code

* remove re-added resources

* Update version.txt

* run graphql tests

* remove cookie-secure setting no longer necessary

* remove common-disable-cookie-http-secure-for-dev-and-test.adoc

Co-authored-by: Iván López <lopezi@objectcomputing.com>
Co-authored-by: Burt Beckwith <burt@burtbeckwith.com>
AndreaLaGrotteria pushed a commit to AndreaLaGrotteria/micronaut-guides that referenced this issue Oct 3, 2024
* change version to 3.0.0-SNAPSHOT

* uses Jakarta annotation in 3.0.x branch (micronaut-projects#303)

* replace javax.inject.Inject with jakarta

* replace javax.inject.Singleton with jakarta

* for single guide don't execute every test

* gradle task to replace javax.inject imports

* fix build

* Replace usage of deprecated methods (micronaut-projects#350)

* Use undeprecated method

* remove deprecated method

* pass null to validateToken

* add import to custom replace task javax.inject (micronaut-projects#365)

* fetch annotation value using javax.inject.Named (micronaut-projects#364)

see: micronaut-projects/micronaut-core#5743

* disable cookie-secure for dev and test (micronaut-projects#362)

* remove @eventlistener from persistToken (micronaut-projects#361)

* ignore graphql tests (micronaut-projects#363)

* ignore gorm tests (micronaut-projects#360)

* Annotated gorm entities as introspected (micronaut-projects#369)

* Revert "ignore gorm tests (micronaut-projects#360)"

This reverts commit 6501790.

* annotate Gorm entities with @introspected

Close: micronaut-projects#366

* Reactor (micronaut-projects#376)

* rxjava2 to reactor

* Update BookCatalogueClientStub.groovy

* remove MVCC config

* blockFirst not blockingFirst

* Use Mono.from

* add reactor-core dependency

* add args to Micronaut.run in groovy

* guides fixes for reactor move

* fix reactor

* fix kotlin function guide

* merge master

* replace @SingleResult Publisher with Mono

See: micronaut-projects#393

* fix jakarta imports

* Update security code

* remove re-added resources

* Update version.txt

* run graphql tests

* remove cookie-secure setting no longer necessary

* remove common-disable-cookie-http-secure-for-dev-and-test.adoc

Co-authored-by: Iván López <lopezi@objectcomputing.com>
Co-authored-by: Burt Beckwith <burt@burtbeckwith.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant