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

[BUG] SpringBoot3: Use jackson-jakarta-rs-json-provider instead of jackson-jaxrs-json-provider #416

Open
2 tasks done
corentin-pasquier opened this issue Sep 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@corentin-pasquier
Copy link

corentin-pasquier commented Sep 26, 2024

Describe the bug.

We were trying to use the library to generate code; this code deployed as as jar to our repository and imported in a Spring Boot 3 project.
We have an error when starting our Spring Boot 3 project and we find out that this dependency is causing problem:

<dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-json-provider</artifactId>
    <scope>compile</scope>
</dependency>

This dependency is using old javax, this dependency should be replaced (when using springBoot3 and not springBoot2) by:

<dependency>
    <groupId>com.fasterxml.jackson.jakarta.rs</groupId>
    <artifactId>jackson-jakarta-rs-json-provider</artifactId>
    <scope>compile</scope>
</dependency>

Expected behavior

Use Jakarta compliant dependency for a Spring Boot 3 generated code.

<dependency>
    <groupId>com.fasterxml.jackson.jakarta.rs</groupId>
    <artifactId>jackson-jakarta-rs-json-provider</artifactId>
    <scope>compile</scope>
</dependency>

Screenshots

image

How to Reproduce

  1. Generate a Spring Boot 3 project
    Follow the link with every needed dependencies to reproduce Spring Initializr

  2. Generate code with spring template

$ node --version
v18.14.2
$ npm i -g @asyncapi/cli
$ npm i -g @asyncapi/java-spring-template
$ wget https://raw.githubusercontent.com/ab510/asyncapi/refs/heads/master/examples/2.0.0/streetlights.yml
$ asyncapi generate fromTemplate streetlights.yml @asyncapi/java-spring-template --param maven=true --output generated-
  1. Install package to your device maven repository
    Before I had to change StreetLightId equals function so it returns true (there is a compilation error).
    image
$ cd generated-code
$ mvn install -DskipTests
  1. Then add the dependency to your Spring Boot 3 project:
	<dependencies>
		<dependency>
			<groupId>com.asyncapi</groupId>
			<artifactId>untitled</artifactId>
			<version>1.0-SNAPSHOT</version>
		</dependency>
	</dependencies>
  1. Start your application
    image

  2. Change the dependency to the jakarta one, it works

🥦 Browser

Google Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

@corentin-pasquier corentin-pasquier added the bug Something isn't working label Sep 26, 2024
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

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