Relative Content

Tag Archive for javaquarkus

Maven is not picking up environment variables from `.env` file when trying to compile Quarkus project

I am using a M1 MAC and GRAALVM 23 using ./mvnw package -Dnative command. However I am running into issues where it’s not picking up the environment variables from my .env file. I’m not sure how to go about fixing this? My whole intention is to compile this and then run this in Docker using the Dockerfile.native file that is provided by Quarkus. It works just fine locally. I had to limit the output below since it was beyond the 30K character limit.

How to properly mock @Startup CDI bean?

I have Quarkus/Jakarta REST API. It contains a CDI bean which is annotated with @Startup. In short, it’s initializing the main service class for that REST API.

How to properly mock @Startup CDI bean?

I have Quarkus/Jakarta REST API. It contains a CDI bean which is annotated with @Startup. In short, it’s initializing the main service class for that REST API.

Questions about how the quarkus framework integrates with knife4j

Recently I used the swagger-ui he started on the quarkus project and found the native swagger-ui very difficult to use, and I want to port knife4j pages to the quarkus project. So I read the knife4j source code and found that knife4j essentially uses springdoc-openapi. After entering the knife4j home page, I will call the /v3/api-docs/swagger-config interface. This interface is also provided by springdoc-openapi, which returns some project documentation information and the address to get interface information, such as {{{}}
“configUrl”: “/v3/api-docs/swagger-config”,
“oauth2RedirectUrl”: “http://localhost:8085/swagger-ui/oauth2-redirect.html”,
“operationsSorter”: “alpha”,
“tagsSorter”: “alpha”,
“urls”: [
{
“url”: “/v3/api-docs/default”,
“name”: “default”
}
].
“validatorUrl”: “”
} The url field in the urls returns the address from which the project fetched interface information. After the /v3/api-docs/swagger-config interface returns, call /v3/api-docs/default to get the interface information. I have basically understood the knife4j process for obtaining interface data, and I plan to transplant it into my quarkus project. After introducing smallrye-openapi into my quarkus project, I can obtain interface information from /q/openapi. However, the /v3/api-docs/swagger-config interface was not provided, so I manually wrote this interface to return the relevant information needed inside. It can be used normally here, and it is considered a successful transplant. The catch is that if I were to use knife4j on other quarkus projects, I would have to repeat the above steps and write the interface separately. I decided that this was not perfect enough, so I planned to write a jar package that would allow quarkus projects to access knife4j pages and provide the /v3/api-docs/swagger-config interface required for knife4j pages. I tried to write such a jar package by myself, but I found that I couldn’t do it, because to provide such an interface, I needed to create a quarkus project and introduce some dependencies such as Quarkus-resteasy -reactive, so whether there would be version problems, for example: The quarkus version in the jar package I wrote is 3.2, but the version of the project that introduced this jar package is 3.11 so that there will be different versions of the problem. How do I write this jar package? Can provide http interface with address /v3/api-docs/default without version conflict problem, and can be directly used by other quarkus projects?