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

Micronaut not picking up spring @RestController apis defined in 3rd party spring boot jar #597

Open
subash89 opened this issue Jun 3, 2024 · 0 comments

Comments

@subash89
Copy link

subash89 commented Jun 3, 2024

Expected Behavior

I use @import(org.myapp.class) in my Micronaut-spring app class. And expect it to pickup the XGreetingController defined in the 3rd party jar.

Actual Behaviour

Expect the api defined in 3rd party jar to be picked up and api should return 200ok response.

Steps To Reproduce

Two Projects springboot and micronautspring Zip
springtomicronaut.zip

  1. Go to springboot and mvn clean install
  2. Go to micronautspring and mvn clean install
  3. The micronautspring project have a dependency of Some documentation fixes micronaut-core#1 springboot.
  4. Now start app inside micronautspring by java -jar target/default-0.1.jar

Invoke APIs
5. Invoke api directly defined in micronautspring app itelf. curl -v -X 'GET' 'http://localhost:8080/greeting' and gives 200OK.
6. Invoke api defined in 3rd party jar springboot. curl -v -X 'GET' 'http://localhost:8080/hello' and gives 404.

Reference code. Refer zip file for complete examples.

Controller defined in Micronaut spring app and doing an @import as follows.

@SpringBootApplication // <1>
@Import(org.myapp.XGreetingController.class)
public class Application {

    public static void main(String... args) {
        Micronaut.run(Application.class);
    }
}

Question is how to get micronautspring app to pickup/find the controller defined in the springboot app jar ?

Environment Information

JDK 21

Example Application

No response

Version

4.4.3

@graemerocher graemerocher transferred this issue from micronaut-projects/micronaut-core Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant