Auto-detect @RestController in Quarkus project ?

330 views
Skip to first unread message

Sébastien Dionne

unread,
Mar 4, 2021, 11:45:44 AM3/4/21
to Quarkus Development mailing list
I have a Quarkus project using 1.20.1.Final

I received a new requirement for my application.  I need to expose a endpoint that in located in a jar and that endpoint is using Spring web. @RestController

I added this
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-spring-web</artifactId>
</dependency>

into my project but I don't think Quarkus is looking into my jar.  I don't see the link either in Swagger-ui.  Is it something supported ?

The class with the endpoint look like this


@RestController
@RequestMapping("/api/v1/loggers")
public class LoggingControllerV1 {

private final LoggingSettingsService loggingSettingsService;

public LoggingControllerV1(LoggingSettingsService loggingSettingsService) {
this.loggingSettingsService = loggingSettingsService;
}

@GetMapping("")
public LoggerSetting getLogger(@RequestParam String loggerName) {
return loggingSettingsService.getLogger(loggerName);
}
....

Paul Carter-Brown

unread,
Mar 4, 2021, 11:49:39 AM3/4/21
to sebastie...@gmail.com, Quarkus Development mailing list
While you there, please o please email me a winning lotto number.

Sorry, couldn't resist. I assume its not 1.20.1.Final :-)

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/795996d0-2996-4431-b85b-7bf47498d648n%40googlegroups.com.

Sébastien Dionne

unread,
Mar 4, 2021, 11:54:50 AM3/4/21
to Quarkus Development mailing list
Ahhhhh. I'm not that good. Wrote too fast 

using 1.12.1.Final  

Georgios Andrianakis

unread,
Mar 4, 2021, 11:55:07 AM3/4/21
to Paul Carter-Brown, Sébastien Dionne, Quarkus Development mailing list
This is more of a question for StackOverflow and I am pretty sure that it will work if you follow the advice outlined here: https://stackoverflow.com/a/55513723/2504224

Sébastien Dionne

unread,
Mar 4, 2021, 1:37:10 PM3/4/21
to Quarkus Development mailing list
thanks.  I add  a empty META-INF\beans.xml  into my external jar and did : mvn clean install   in that module


that fixed few injection problems, but I still got one from Spring.



Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.springframework.boot.logging.LoggerGroups and qualifiers [@Default]
        - java member: com.comact.logging.service.SpringActuatorCustomHandling#<init>()
        - declared on CLASS bean [types=[com.comact.logging.service.SpringActuatorCustomHandling], qualifiers=[@Named(value = "springActuatorCustomHandling"), @Default, @Any], target=com.comact.logging.service.SpringActuatorCustomHandling]
                at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:484)
                at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:378)
                at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:247)
                ... 12 more


I try few combinaisons for : 

quarkus.index-dependency.logging.group-id=org.springframework.boot
quarkus.index-dependency.logging.artifact-id=logging.LoggingSystem 

try that too
quarkus.index-dependency.logging.group-id=org.springframework.boot
quarkus.index-dependency.logging.artifact-id=spring-boot


gut I always get something like that


2021-03-04 13:29:42,151 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.RuntimeException: Could not resolve artifact org.springframework.boot :logging.LoggingSystem ::jar among the runtime dependencies of the application
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addIndexDependencyPaths(ApplicationArchiveBuildStep.java:156)
        at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:122)
....


the class is located in

.m2\repository\org\springframework\boot\spring-boot\2.4.2\spring-boot-2.4.2.jar
.m2\repository\org\springframework\boot\spring-boot\2.4.2\spring-boot-2.4.2.jar!\org\springframework\boot\logging\LoggingSystem.class


what should be the correct values for : quarkus.index-dependency*  ?

Sébastien Dionne

unread,
Mar 4, 2021, 2:30:08 PM3/4/21
to Quarkus Development mailing list
I added this in my pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot</artifactId>
      <version>2.4.2</version>
</dependency>
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
      <version>2.4.2</version>
</dependency>


with this config

quarkus.index-dependency.loggingactuator.group-id=org.springframework.boot
quarkus.index-dependency.loggingactuator.artifact-id=spring-boot-starter-actuator
quarkus.index-dependency.logging.group-id=org.springframework.boot
quarkus.index-dependency.logging.artifact-id=spring-boot


I did mvn clean quarkus:dev

the output is :

[INFO] Checking for existing resources in: C:\workspace\bidgroup\kubernetes-api\src\main\kubernetes.
2021-03-04 14:27:26,801 INFO  [org.jbo.threads] (main) JBoss Threads version 3.2.0.Final
2021-03-04 14:27:30,097 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems:
[1] Unsatisfied dependency for type org.springframework.boot.logging.LoggingSystem and qualifiers [@Default]
        - java member: com.comact.logging.service.SpringActuatorCustomHandling#<init>()
        - declared on CLASS bean [types=[org.springframework.boot.actuate.logging.LoggersEndpoint, java.lang.Object, com.comact.logging.service.SpringActuatorCustomHandling], qualifiers=[@Named(value = "springActuatorCustomHandling"), @Default, @Any], target=com.comact.logging.service.SpringActuatorCustomHandli
ng]
[2] Unsatisfied dependency for type org.springframework.boot.logging.LoggerGroups and qualifiers [@Default]
        - java member: com.comact.logging.service.SpringActuatorCustomHandling#<init>()
        - declared on CLASS bean [types=[org.springframework.boot.actuate.logging.LoggersEndpoint, java.lang.Object, com.comact.logging.service.SpringActuatorCustomHandling], qualifiers=[@Named(value = "springActuatorCustomHandling"), @Default, @Any], target=com.comact.logging.service.SpringActuatorCustomHandli
ng]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1086)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:255)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:428)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)



my class look like that

....
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggerGroups;
import org.springframework.boot.logging.LoggingSystem;

@Component
public class SpringActuatorCustomHandling extends LoggersEndpoint {

private static final Logger LOGGER = LoggerFactory.getLogger(SpringActuatorCustomHandling.class);
private final LoggingSettingDao loggingSettingDao;



@Autowired
public SpringActuatorCustomHandling(LoggingSystem loggingSystem, LoggerGroups loggerGroups, LoggingSettingDao loggingSettingDao) {
super(loggingSystem, loggerGroups);
this.loggingSettingDao = loggingSettingDao;
}

Georgios Andrianakis

unread,
Mar 5, 2021, 1:51:33 AM3/5/21
to Sébastien Dionne, Quarkus Development mailing list
It is highly unlikely that the code you mention from Spring Boot will work

Sébastien Dionne

unread,
Mar 5, 2021, 6:56:35 AM3/5/21
to Quarkus Development mailing list
That class : SpringActuatorCustomHandling    it's our class.  There is something that I could change that will solve the problem ?  

So far, I have 2 project in Quarkus and all the others are in Spring Boot.  At this point I try to create bridge that will allow are commons libraries to work in the two frameworks.  Now I have to fix that one.  

Georgios Andrianakis

unread,
Mar 5, 2021, 6:58:54 AM3/5/21
to Sébastien Dionne, Quarkus Development mailing list
I can't really say as org.springframework.boot.logging.LoggingSystem and org.springframework.boot.actuate.logging.LoggersEndpoint aren't supported in Quarkus

Reply all
Reply to author
Forward
0 new messages