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

R2DBC errors after upgrading to Spring Boot 2.6 #17271

Closed
mraible opened this issue Dec 11, 2021 · 6 comments
Closed

R2DBC errors after upgrading to Spring Boot 2.6 #17271

mraible opened this issue Dec 11, 2021 · 6 comments
Labels
area: bug 🐛 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: reactive ⚛️ Spring WebFlux $500 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@mraible
Copy link
Contributor

mraible commented Dec 11, 2021

Overview of the issue

The upgrade to Spring Boot 2.6 is happening in #16787. Tests are currently failing for the vue-gateway project because of an R2DBC issue.

Error:  tech.jhipster.sample.web.rest.OperationResourceIT.putNewOperation  Time elapsed: 0.016 s  <<< ERROR!
org.springframework.r2dbc.BadSqlGrammarException: 
executeMany; bad SQL grammar [SELECT e.id AS e_id, e.date AS e_date, e.description AS e_description, e.amount AS e_amount, 
e.bank_account_id AS e_bank_account_id, bankAccount.id AS bankAccount_id, bankAccount.name AS bankAccount_name, 
bankAccount.guid AS bankAccount_guid, bankAccount.bank_number AS bankAccount_bank_number, 
bankAccount.agency_number AS bankAccount_agency_number, bankAccount.last_operation_duration AS 
bankAccount_last_operation_duration, bankAccount.mean_operation_duration AS bankAccount_mean_operation_duration, 
bankAccount.mean_queue_duration AS bankAccount_mean_queue_duration, bankAccount.balance AS bankAccount_balance, 
bankAccount.opening_day AS bankAccount_opening_day, bankAccount.last_operation_date AS 
bankAccount_last_operation_date, bankAccount.active AS bankAccount_active, bankAccount.account_type AS 
bankAccount_account_type, bankAccount.attachment AS bankAccount_attachment, bankAccount.attachment_content_type AS 
bankAccount_attachment_content_type, bankAccount.description AS bankAccount_description, bankAccount.user_id AS 
bankAccount_user_id FROM operation e LEFT OUTER JOIN bank_account bankAccount ON e.bank_account_id = bankAccount.id 
WHERE id = 4 WHERE e.id = 4]; nested exception is io.r2dbc.spi.R2dbcBadGrammarException: [90059] [90059] Ambiguous 
column name "ID"; SQL statement:
SELECT e.id AS e_id, e.date AS e_date, e.description AS e_description, e.amount AS e_amount, e.bank_account_id AS 
e_bank_account_id, bankAccount.id AS bankAccount_id, bankAccount.name AS bankAccount_name, bankAccount.guid AS 
bankAccount_guid, bankAccount.bank_number AS bankAccount_bank_number, bankAccount.agency_number AS 
bankAccount_agency_number, bankAccount.last_operation_duration AS bankAccount_last_operation_duration, 
bankAccount.mean_operation_duration AS bankAccount_mean_operation_duration, bankAccount.mean_queue_duration AS 
bankAccount_mean_queue_duration, bankAccount.balance AS bankAccount_balance, bankAccount.opening_day AS 
bankAccount_opening_day, bankAccount.last_operation_date AS bankAccount_last_operation_date, bankAccount.active AS 
bankAccount_active, bankAccount.account_type AS bankAccount_account_type, bankAccount.attachment AS 
bankAccount_attachment, bankAccount.attachment_content_type AS bankAccount_attachment_content_type, 
bankAccount.description AS bankAccount_description, bankAccount.user_id AS bankAccount_user_id FROM operation e LEFT 
OUTER JOIN bank_account bankAccount ON e.bank_account_id = bankAccount.id WHERE id = 4 WHERE e.id = 4 [90059-200]
	at tech.jhipster.sample.web.rest.OperationResourceIT.putNewOperation(OperationResourceIT.java:293)
Motivation for or Use Case

I'd like to see JHipster upgraded to Spring Boot 2.6.0 so I can try to integrate Spring Native with the latest release. I have a talk with Josh Long on Tuesday that I'd like to show off JHipster + Spring Native in. You can see our previous work with JHipster 7.2 and Spring Boot 2.5 in https://github.com/mraible/spring-native-examples.

Reproduce the error

I recreated the vue-gateway application and pushed it to GitHub:

git clone -b skip_ci-spring-boot_2.6.0 [email protected]:jhipster/jhipster-bom.git
cd jhipster-bom
./mvnw install -Dgpg.skip=true
cd ..
git clone [email protected]:mraible/vue-gateway.git
cd vue-gateway
./mvnw verify
Related issues

#16787

JHipster Version(s)
[email protected] /Users/mraible/Downloads/vue-gateway
└── [email protected]

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "clientPackageManager": "npm",
    "applicationType": "gateway",
    "reactive": true,
    "baseName": "jhipster",
    "jhiPrefix": "",
    "otherModules": [],
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": ["gatling", "cypress"],
    "blueprints": [],
    "creationTimestamp": 1594452153587,
    "serviceDiscoveryType": false,
    "authenticationType": "jwt",
    "packageName": "tech.jhipster.sample",
    "packageFolder": "tech/jhipster/sample",
    "serverPort": "8080",
    "cacheProvider": "no",
    "enableHibernateCache": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "vue",
    "clientTheme": "none",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "clientThemeVariant": "primary",
    "languages": ["en"],
    "jhipsterVersion": "7.4.1",
    "pages": [],
    "devServerPort": 9060,
    "withAdminUi": true,
    "enableGradleEnterprise": false,
    "entities": [
      "Operation",
      "FieldTestEntity",
      "FieldTestInfiniteScrollEntity",
      "FieldTestMapstructAndServiceClassEntity",
      "FieldTestPaginationEntity",
      "FieldTestServiceClassAndJpaFilteringEntity",
      "FieldTestServiceImplEntity",
      "EntityWithDTO",
      "EntityWithServiceClassAndPagination",
      "EntityWithServiceImplAndPagination",
      "EntityWithServiceImplAndDTO",
      "EntityWithPaginationAndDTO",
      "EntityWithServiceClassPaginationAndDTO",
      "EntityWithServiceImplPaginationAndDTO",
      "MapsIdUserProfileWithDTO",
      "FieldTestEnumWithValue",
      "BankAccount",
      "Label"
    ]
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Operation {
  date Instant required
  description String
  amount BigDecimal required
}
entity FieldTestEntity {
  stringTom String
  stringRequiredTom String required
  stringMinlengthTom String minlength(0)
  stringMaxlengthTom String maxlength(20)
  stringPatternTom String pattern(/^[a-zA-Z0-9]*$/)
  numberPatternTom String pattern(/^[0-9]+$/)
  numberPatternRequiredTom String pattern(/^[0-9]+$/) required
  integerTom Integer
  integerRequiredTom Integer required
  integerMinTom Integer min(0)
  integerMaxTom Integer max(100)
  longTom Long
  longRequiredTom Long required
  longMinTom Long min(0)
  longMaxTom Long max(100)
  floatTom Float
  floatRequiredTom Float required
  floatMinTom Float min(0)
  floatMaxTom Float max(100)
  doubleRequiredTom Double required
  doubleMinTom Double min(0)
  doubleMaxTom Double max(100)
  bigDecimalRequiredTom BigDecimal required
  bigDecimalMinTom BigDecimal min(0)
  bigDecimalMaxTom BigDecimal max(100)
  localDateTom LocalDate
  localDateRequiredTom LocalDate required
  instantTom Instant
  instantRequiredTom Instant required
  zonedDateTimeTom ZonedDateTime
  zonedDateTimeRequiredTom ZonedDateTime required
  durationTom Duration
  durationRequiredTom Duration required
  booleanTom Boolean
  booleanRequiredTom Boolean required
  enumTom EnumFieldClass
  enumRequiredTom EnumRequiredFieldClass required
  uuidTom UUID
  uuidRequiredTom UUID required
  byteImageTom ImageBlob
  byteImageRequiredTom ImageBlob required
  byteImageMinbytesTom ImageBlob minbytes(0)
  byteImageMaxbytesTom ImageBlob maxbytes(10000)
  byteAnyTom AnyBlob
  byteAnyRequiredTom AnyBlob required
  byteAnyMinbytesTom AnyBlob minbytes(0)
  byteAnyMaxbytesTom AnyBlob maxbytes(10000)
  byteTextTom TextBlob
  byteTextRequiredTom TextBlob required
}
entity FieldTestInfiniteScrollEntity {
  stringHugo String
  stringRequiredHugo String required
  stringMinlengthHugo String minlength(0)
  stringMaxlengthHugo String maxlength(20)
  stringPatternHugo String pattern(/^[a-zA-Z0-9]*$/)
  integerHugo Integer
  integerRequiredHugo Integer required
  integerMinHugo Integer min(0)
  integerMaxHugo Integer max(100)
  longHugo Long
  longRequiredHugo Long required
  longMinHugo Long min(0)
  longMaxHugo Long max(100)
  floatHugo Float
  floatRequiredHugo Float required
  floatMinHugo Float min(0)
  floatMaxHugo Float max(100)
  doubleRequiredHugo Double required
  doubleMinHugo Double min(0)
  doubleMaxHugo Double max(100)
  bigDecimalRequiredHugo BigDecimal required
  bigDecimalMinHugo BigDecimal min(0)
  bigDecimalMaxHugo BigDecimal max(100)
  localDateHugo LocalDate
  localDateRequiredHugo LocalDate required
  instantHugo Instant
  instanteRequiredHugo Instant required
  zonedDateTimeHugo ZonedDateTime
  zonedDateTimeRequiredHugo ZonedDateTime required
  durationHugo Duration
  durationRequiredHugo Duration required
  booleanHugo Boolean
  booleanRequiredHugo Boolean required
  enumHugo EnumFieldClass
  enumRequiredHugo EnumRequiredFieldClass required
  uuidHugo UUID
  uuidRequiredHugo UUID required
  byteImageHugo ImageBlob
  byteImageRequiredHugo ImageBlob required
  byteImageMinbytesHugo ImageBlob minbytes(0)
  byteImageMaxbytesHugo ImageBlob maxbytes(10000)
  byteAnyHugo AnyBlob
  byteAnyRequiredHugo AnyBlob required
  byteAnyMinbytesHugo AnyBlob minbytes(0)
  byteAnyMaxbytesHugo AnyBlob maxbytes(10000)
  byteTextHugo TextBlob
  byteTextRequiredHugo TextBlob required
}
entity FieldTestMapstructAndServiceClassEntity {
  stringEva String
  stringRequiredEva String required
  stringMinlengthEva String minlength(0)
  stringMaxlengthEva String maxlength(20)
  stringPatternEva String pattern(/^[a-zA-Z0-9]*$/)
  integerEva Integer
  integerRequiredEva Integer required
  integerMinEva Integer min(0)
  integerMaxEva Integer max(100)
  longEva Long
  longRequiredEva Long required
  longMinEva Long min(0)
  longMaxEva Long max(100)
  floatEva Float
  floatRequiredEva Float required
  floatMinEva Float min(0)
  floatMaxEva Float max(100)
  doubleRequiredEva Double required
  doubleMinEva Double min(0)
  doubleMaxEva Double max(100)
  bigDecimalRequiredEva BigDecimal required
  bigDecimalMinEva BigDecimal min(0)
  bigDecimalMaxEva BigDecimal max(100)
  localDateEva LocalDate
  localDateRequiredEva LocalDate required
  instantEva Instant
  instanteRequiredEva Instant required
  zonedDateTimeEva ZonedDateTime
  zonedDateTimeRequiredEva ZonedDateTime required
  durationEva Duration
  durationRequiredEva Duration required
  booleanEva Boolean
  booleanRequiredEva Boolean required
  enumEva EnumFieldClass
  enumRequiredEva EnumRequiredFieldClass required
  uuidEva UUID
  uuidRequiredEva UUID required
  byteImageEva ImageBlob
  byteImageRequiredEva ImageBlob required
  byteImageMinbytesEva ImageBlob minbytes(0)
  byteImageMaxbytesEva ImageBlob maxbytes(10000)
  byteAnyEva AnyBlob
  byteAnyRequiredEva AnyBlob required
  byteAnyMinbytesEva AnyBlob minbytes(0)
  byteAnyMaxbytesEva AnyBlob maxbytes(10000)
  byteTextEva TextBlob
  byteTextRequiredEva TextBlob required
}
entity FieldTestPaginationEntity {
  stringAlice String
  stringRequiredAlice String required
  stringMinlengthAlice String minlength(0)
  stringMaxlengthAlice String maxlength(20)
  stringPatternAlice String pattern(/^[a-zA-Z0-9]*$/)
  integerAlice Integer
  integerRequiredAlice Integer required
  integerMinAlice Integer min(0)
  integerMaxAlice Integer max(100)
  longAlice Long
  longRequiredAlice Long required
  longMinAlice Long min(0)
  longMaxAlice Long max(100)
  floatAlice Float
  floatRequiredAlice Float required
  floatMinAlice Float min(0)
  floatMaxAlice Float max(100)
  doubleRequiredAlice Double required
  doubleMinAlice Double min(0)
  doubleMaxAlice Double max(100)
  bigDecimalRequiredAlice BigDecimal required
  bigDecimalMinAlice BigDecimal min(0)
  bigDecimalMaxAlice BigDecimal max(100)
  localDateAlice LocalDate
  localDateRequiredAlice LocalDate required
  instantAlice Instant
  instanteRequiredAlice Instant required
  zonedDateTimeAlice ZonedDateTime
  zonedDateTimeRequiredAlice ZonedDateTime required
  durationAlice Duration
  durationRequiredAlice Duration required
  booleanAlice Boolean
  booleanRequiredAlice Boolean required
  enumAlice EnumFieldClass
  enumRequiredAlice EnumRequiredFieldClass required
  uuidAlice UUID
  uuidRequiredAlice UUID required
  byteImageAlice ImageBlob
  byteImageRequiredAlice ImageBlob required
  byteImageMinbytesAlice ImageBlob minbytes(0)
  byteImageMaxbytesAlice ImageBlob maxbytes(10000)
  byteAnyAlice AnyBlob
  byteAnyRequiredAlice AnyBlob required
  byteAnyMinbytesAlice AnyBlob minbytes(0)
  byteAnyMaxbytesAlice AnyBlob maxbytes(10000)
  byteTextAlice TextBlob
  byteTextRequiredAlice TextBlob required
}
entity FieldTestServiceClassAndJpaFilteringEntity {
  stringBob String
  stringRequiredBob String required
  stringMinlengthBob String minlength(0)
  stringMaxlengthBob String maxlength(20)
  stringPatternBob String pattern(/^[a-zA-Z0-9]*$/)
  integerBob Integer
  integerRequiredBob Integer required
  integerMinBob Integer min(0)
  integerMaxBob Integer max(100)
  longBob Long
  longRequiredBob Long required
  longMinBob Long min(0)
  longMaxBob Long max(100)
  floatBob Float
  floatRequiredBob Float required
  floatMinBob Float min(0)
  floatMaxBob Float max(100)
  doubleRequiredBob Double required
  doubleMinBob Double min(0)
  doubleMaxBob Double max(100)
  bigDecimalRequiredBob BigDecimal required
  bigDecimalMinBob BigDecimal min(0)
  bigDecimalMaxBob BigDecimal max(100)
  localDateBob LocalDate
  localDateRequiredBob LocalDate required
  instantBob Instant
  instanteRequiredBob Instant required
  zonedDateTimeBob ZonedDateTime
  zonedDateTimeRequiredBob ZonedDateTime required
  durationBob Duration
  durationRequiredBob Duration required
  booleanBob Boolean
  booleanRequiredBob Boolean required
  enumBob EnumFieldClass
  enumRequiredBob EnumRequiredFieldClass required
  uuidBob UUID
  uuidRequiredBob UUID required
  byteImageBob ImageBlob
  byteImageRequiredBob ImageBlob required
  byteImageMinbytesBob ImageBlob minbytes(0)
  byteImageMaxbytesBob ImageBlob maxbytes(10000)
  byteAnyBob AnyBlob
  byteAnyRequiredBob AnyBlob required
  byteAnyMinbytesBob AnyBlob minbytes(0)
  byteAnyMaxbytesBob AnyBlob maxbytes(10000)
  byteTextBob TextBlob
  byteTextRequiredBob TextBlob required
}
entity FieldTestServiceImplEntity {
  stringMika String
  stringRequiredMika String required
  stringMinlengthMika String minlength(0)
  stringMaxlengthMika String maxlength(20)
  stringPatternMika String pattern(/^[a-zA-Z0-9]*$/)
  integerMika Integer
  integerRequiredMika Integer required
  integerMinMika Integer min(0)
  integerMaxMika Integer max(100)
  longMika Long
  longRequiredMika Long required
  longMinMika Long min(0)
  longMaxMika Long max(100)
  floatMika Float
  floatRequiredMika Float required
  floatMinMika Float min(0)
  floatMaxMika Float max(100)
  doubleRequiredMika Double required
  doubleMinMika Double min(0)
  doubleMaxMika Double max(100)
  bigDecimalRequiredMika BigDecimal required
  bigDecimalMinMika BigDecimal min(0)
  bigDecimalMaxMika BigDecimal max(100)
  localDateMika LocalDate
  localDateRequiredMika LocalDate required
  instantMika Instant
  instanteRequiredMika Instant required
  zonedDateTimeMika ZonedDateTime
  zonedDateTimeRequiredMika ZonedDateTime required
  durationMika Duration
  durationRequiredMika Duration required
  booleanMika Boolean
  booleanRequiredMika Boolean required
  enumMika EnumFieldClass
  enumRequiredMika EnumRequiredFieldClass required
  uuidMika UUID
  uuidRequiredMika UUID required
  byteImageMika ImageBlob
  byteImageRequiredMika ImageBlob required
  byteImageMinbytesMika ImageBlob minbytes(0)
  byteImageMaxbytesMika ImageBlob maxbytes(10000)
  byteAnyMika AnyBlob
  byteAnyRequiredMika AnyBlob required
  byteAnyMinbytesMika AnyBlob minbytes(0)
  byteAnyMaxbytesMika AnyBlob maxbytes(10000)
  byteTextMika TextBlob
  byteTextRequiredMika TextBlob required
}
entity EntityWithDTO {
  emma String
}
entity EntityWithServiceClassAndPagination {
  enzo String
}
entity EntityWithServiceImplAndPagination {
  hugo String
}
entity EntityWithServiceImplAndDTO {
  louis String
}
entity EntityWithPaginationAndDTO {
  lea String
}
entity EntityWithServiceClassPaginationAndDTO {
  lena String
}
entity EntityWithServiceImplPaginationAndDTO {
  theo String
}
entity MapsIdUserProfileWithDTO (maps_id_user_profile_withdto) {
  dateOfBirth Instant
}
entity FieldTestEnumWithValue (entity_with_enums) {
  myFieldA MyEnumA
  myFieldB MyEnumB
  myFieldC MyEnumC
}
entity BankAccount {
  name String required
  guid UUID
  bankNumber Integer
  agencyNumber Long
  lastOperationDuration Float
  meanOperationDuration Double
  meanQueueDuration Duration
  balance BigDecimal required
  openingDay LocalDate
  lastOperationDate Instant
  active Boolean
  accountType BankAccountType
  attachment AnyBlob
  description TextBlob
}
entity Label {
  labelName String required minlength(3)
}
enum EnumFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}
enum EnumRequiredFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}
enum MyEnumA {
  AAA,
  BBB
}
enum MyEnumB {
  AAA (aaa_aaa),
  BBB
}
enum MyEnumC {
  AAA (aaa_aaa),
  BBB (b and b)
}
enum BankAccountType {
  CHECKING,
  SAVINGS,
  LOAN
}

relationship OneToOne {
  MapsIdUserProfileWithDTO{user(login)} to User
}
relationship OneToMany {
  BankAccount{operation} to Operation{bankAccount(name)}
}
relationship ManyToOne {
  BankAccount{user(login)} to User
}
relationship ManyToMany {
  Operation{label(labelName)} to Label{operation}
}

paginate Operation, FieldTestInfiniteScrollEntity with infinite-scroll
paginate FieldTestPaginationEntity, EntityWithServiceClassAndPagination, EntityWithServiceImplAndPagination, EntityWithPaginationAndDTO, EntityWithServiceClassPaginationAndDTO, EntityWithServiceImplPaginationAndDTO, Label with pagination
clientRootFolder Operation, BankAccount, Label with test-root
dto FieldTestMapstructAndServiceClassEntity, EntityWithDTO, EntityWithServiceImplAndDTO, EntityWithPaginationAndDTO, EntityWithServiceClassPaginationAndDTO, EntityWithServiceImplPaginationAndDTO, MapsIdUserProfileWithDTO with mapstruct
service FieldTestMapstructAndServiceClassEntity, FieldTestServiceClassAndJpaFilteringEntity, EntityWithServiceClassAndPagination, EntityWithServiceClassPaginationAndDTO, Label with serviceClass
service FieldTestServiceImplEntity, EntityWithServiceImplAndPagination, EntityWithServiceImplAndDTO, EntityWithServiceImplPaginationAndDTO, MapsIdUserProfileWithDTO, BankAccount with serviceImpl
angularSuffix BankAccount with mySuffix
readOnly Label

Environment and Tools

openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

git version 2.30.1 (Apple Git-130)

node: v14.18.1

npm: 8.1.2

Docker version 20.10.11, build dea9396

Docker Compose version v2.2.1

@Tcharl
Copy link
Contributor

Tcharl commented Dec 14, 2021

@mraible it now works on my branch, as long as you don't use gradle or mongo. I'll continue to improve it to have everything green

@Tcharl
Copy link
Contributor

Tcharl commented Jan 11, 2022

@Tcharl Tcharl closed this as completed Jan 11, 2022
@pascalgrimaud pascalgrimaud added this to the 7.6.0 milestone Jan 12, 2022
@mraible
Copy link
Contributor Author

mraible commented Feb 4, 2022

This still happens with JHipster 7.6.0.

Caused by: java.lang.IllegalStateException: No suitable constructor found on class 
org.springframework.data.r2dbc.repository.support.SimpleR2dbcRepository to match the given arguments: 
org.springframework.data.relational.repository.support.MappingRelationalEntityInformation, 
org.springframework.data.r2dbc.core.R2dbcEntityTemplate, 
org.springframework.data.r2dbc.convert.MappingR2dbcConverter. Make sure you implement a constructor taking these
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.lambda$instantiateClass$6(RepositoryFactorySupport.java:579) ~[na:na]
	at java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.instantiateClass(RepositoryFactorySupport.java:579) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepositoryViaReflection(RepositoryFactorySupport.java:543) ~[na:na]
	at org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory.getTargetRepository(R2dbcRepositoryFactory.java:121) ~[postgres:1.4.1]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:322) ~[postgres:2.6.1]
	at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[na:na]
	at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:328) ~[postgres:2.6.1]
	at org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactoryBean.afterPropertiesSet(R2dbcRepositoryFactoryBean.java:179) ~[postgres:1.4.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[na:an]

Steps to reproduce:

# use SDKMAN to install GraalVM
sdk install java 21.3.0.r17-grl
gu install native-image

# get the project and build a native binary
git clone https://github.com/mraible/spring-native-examples.git
cd spring-native-examples/postgres-webflux
./mvnw package -Pnative,prod -DskipTests

# start Keycloak and PostgreSQL containers with jhkeycloakup and jhpostgresqlup
./target/postgres

@sdeleuze
Copy link

sdeleuze commented Feb 4, 2022

Is this issue native specific?

@mraible
Copy link
Contributor Author

mraible commented Feb 4, 2022

Yes, it works fine when I run the app using mvn spring-boot:run or using my IDE.

@mraible
Copy link
Contributor Author

mraible commented Feb 6, 2022

I figured out the solution to this today. You need to add @Component to Impl classes and add SimpleR2dbcRepository to type hints.

@mraible mraible closed this as completed Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bug 🐛 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: reactive ⚛️ Spring WebFlux $500 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

No branches or pull requests

4 participants