0

Good afternoon, I am working on creating a Quarkus stand alone application, that uses jars created in spring boot. Can those jars be used without them being migrated to Quarkus beforehand? I am aware that while Quarkus uses CDI, spring uses DI.But using the spring extension,can these spring jars be used directly in the new Quarkus application?Meaning spring beans from the spring boot jar can be injected into the Quarkus application using DI annotations like "Autowired"?

Thanks

k.jones
  • 29
  • 6
  • It depends. What kind of Spring annotations are being used? – geoand Jun 21 '22 at 05:27
  • So basically,I was looking at injecting a service from the spring boot jar using @Autowired.This is one case. – k.jones Jun 21 '22 at 11:32
  • 1
    Yes, that should work just fine, as long the dependency is indexed see https://stackoverflow.com/a/55513723/2504224 – geoand Jun 21 '22 at 14:15
  • Had a question regarding indexing the required packages in the application.properties file.For example,if the xyz.jar is the spring boot application,whose spring beans I want to inject in the quarkus application,should the indexing be only for xyz.jar or for all the various dependencies being used by xyz.jar-for example spring-boot-data-starter-jpa – k.jones Jun 29 '22 at 01:08
  • Likely only `xyz.jar` – geoand Jun 29 '22 at 11:02
  • Thank you for your response.I tried that,but I keep getting an nullpointer exception when trying to Autowire a spring bean from the external jar. – k.jones Jun 29 '22 at 11:25
  • I have tried all three ways of indexing - a)using jandex b)having a blank beans.xml in the spring external jar c)updating the application.properties file of the quarkus project with indexes to the spring external jar.Still see the null pointer exception when I simply use @Autowired for the external spring bean in the quarkus application. – k.jones Jul 05 '22 at 13:48
  • Once again, I tried using a blank beans.xml in the external jar to be used in the Quarkus application.I am also using the spring-di extension in the quarkus application.But when I use @Autowired "spring bean ClassName" in the quarkus application,"UnsatisfiedResolutionException" is thrown. – k.jones Jul 20 '22 at 17:30
  • Do you have a sample project I can try? – geoand Jul 26 '22 at 06:14
  • @geoand Thank you for offering to.Will post the code soon. – k.jones Jul 28 '22 at 13:46
  • @geoand I am able to now inject an external non quarkus jar into a quarkus application using a blank META-INF/beans.xml in the external jar .I am now seeing the error "Producer method return type not found in index" for a particular spring class.Not sure what this error means actually. – k.jones Aug 01 '22 at 18:33
  • What class is causing the issue? – geoand Aug 02 '22 at 06:06
  • Thank you for your response. I think I was able to go past the the above issue - "Producer method return type not found in index". Now I am seeing an issue - "Attribute nativeQuery of @Query not supported".The external spring boot jar has native queries being used . for example something like @Query(value="select xyx from ").The quarkus-spring-data-jpa is one dependency being used.I am assuming,there is no support for nativeQuery as yet from quarkus-spring-jpa extension. Do I need to change the queries in the external jar then? – k.jones Aug 03 '22 at 15:55
  • As the error message says, `nativeQuery` is currently not supported in Spring Data JPA – geoand Aug 04 '22 at 05:03
  • Thanks.What is the reason for this error "Producer method return type not found in index" for a particular spring class".In this case the class is "SpringPlatformTransaction".In any case,when this type of error related to particular class occurs,what is the reason and what should be done.Thank you again. – k.jones Aug 04 '22 at 13:43
  • It essentially means that Quarkus does not have enough information about that class – geoand Aug 05 '22 at 05:32
  • Thanks for your response.So then,is using a Producer,a way to provide more info about the class in question to Quarkus? – k.jones Aug 05 '22 at 14:45
  • In this case, whatever jar contains `SpringPlatformTransaction` is not indexed, see https://stackoverflow.com/a/55513723/2504224 for more information – geoand Aug 08 '22 at 04:15

0 Answers0