springboot app looking for GenericResponseService bean - spring-boot

I am new to springboot.
Doing a migration of my service (kotlin)following a guide written at work.
Got this weird exception and cannot find any documentation.
Parameter 3 of method multipleOpenApiResource in org.springdoc.webflux.core.MultipleOpenApiSupportConfiguration required a bean of type 'org.springdoc.core.GenericResponseService' that could not be found.
Action:
Consider defining a bean of type 'org.springdoc.core.GenericResponseService' in your configuration.
Should I define this bean at my #Configuration?
Is this a symptom of dependency missing or bad dependency wiring?

One of my beans was called ResponseBuilder and it conflicted with spring boot.
Sorry for the trouble

Related

How to fix "Consider defining a bean of type 'org.jooq.DSLContext' in your configuration." after update to jOOQ 3.15.0

In my Vaadin and Spring Boot application, I have updated from jOOQ 3.14.12 to 3.15.0. After this update my application is not starting up again. This is the error I get:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in org.komunumo.data.service.MemberService required a bean of type 'org.jooq.DSLContext' that could not be found.
Action:
Consider defining a bean of type 'org.jooq.DSLContext' in your configuration.
I don't understand why I have to define this bean, because with jOOQ 3.14.12 I did not have to. As far as I know, this is done by JooqAutoConfiguration automatically.
Spring Boot 2.6 answer
With Spring Boot 2.6, this issue no longer reproduces, see https://github.com/spring-projects/spring-boot/issues/26439
Spring Boot 2.5 answer
Starting from jOOQ 3.15.0, jOOQ ships with a built-in R2DBC dependency. Spring Boot 2.5 is not yet aware of this, and as such, you'll have to explicitly exclude R2dbcAutoConfiguration (not R2dbcDataAutoConfiguration!) from your spring boot application (unless you're using R2DBC with jOOQ, of course):
#SpringBootApplication(exclude = { R2dbcAutoConfiguration.class })
Note, you may see the following error message:
No qualifying bean of type 'org.jooq.DSLContext' available: expected at least 1 bean which qualifies as autowire candidate.
Which I'm adding here, because otherwise, people might not find this answer from Google.

Spring Integration causes multiple beans error

I'm using Spring Boot and trying use Spring integration (because I want to use its SFTP client). But I got the following error:
Description:
Parameter 0 of constructor in com.example.demo.service.ServiceOne required a single bean, but 2 were found:
- applicationTaskExecutor: defined by method 'applicationTaskExecutor' in class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class]
- taskScheduler: defined in null
Action:
Consider marking one of the beans as #Primary, updating the consumer to accept multiple beans, or using #Qualifier to identify the bean that should be consumed
I'm sure that the error happens after adding dependencies for spring-integration. I've tried to use #Qualifier("applicationTaskExecutor") and creating a bean with #Primary annotation but still unable to run the application. How to fix it?
As error stated there are two TaskExecutor beans in the application context.
One is auto-configured by the TaskExecutionAutoConfiguration and another by Spring Integration for its pollers features which is essentially a TaskScheduler.
What the error description suggest is to use a #Qualifier("applicationTaskExecutor") on the ServiceOne 's Parameter 0 of constructor. You don't need to have #Primary bean because the story is about beans created outside of your code.

GraphQLSchema bean not created - Spring Boot

I am following this example here:- http://www.baeldung.com/spring-graphql
for me the GraphQLSchema bean is not getting autoregistered. it throws me this error:-
No qualifying bean of type 'graphql.schema.GraphQLSchema' available
my Pom file has all requried Spring boot dependecies:-
graphql-spring-boot-starter
graphql-java-tools
graphiql-spring-boot-starter
I have following settings in application.proerties:-
graphql.root=/v1
graphql.servlet.mapping=${graphql.root}/graphql
graphql.servlet.enabled=true
graphql.servlet.corsEnabled=true
Not sure what am I missing, Do I need to explicitly define this bean as on this page:- https://github.com/graphql-java/graphql-spring-boot/blob/master/example/src/main/java/com/embedler/moon/graphql/boot/sample/ApplicationBootConfiguration.java.
But I thought it will autocreate for me, I just need to have *.graphqls on my class path.
I have followed the same tutorial as well and encountered the same error. I ended up figuring out what the issue was and it is that you need to add #Component to the Query class that the tutorial describes.
Once that was done graphiql was finally finding the schema and the /graphql end-point was exposed.

spring-boot 1.2.0.M2 breaks app

I have a spring boot app that worked fine up until I updated from 1.2.0.M1 to 1.2.0.M2. The app will not build because of an UnsatisfiedDependencyException resulting from spring-boot RabbitAutoConfiguration:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'jmsMessagingTemplate' defined in class path resource [org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration$MessagingTemplateConfiguration.class]:
Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.amqp.rabbit.core.RabbitTemplate]: :
No qualifying bean of type [org.springframework.amqp.rabbit.core.RabbitTemplate] is defined:
expected single matching bean but found 3: looperTemplate,pingTemplate,orgRequestTemplate; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException:
No qualifying bean of type [org.springframework.amqp.rabbit.core.RabbitTemplate] is defined:
expected single matching bean but found 3: looperTemplate,pingTemplate,orgRequestTemplate
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:751) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:466) ~[spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]
The problem is I do have RabbitMQ templates, but I have 3 of them and it needs a qualifier to select a single template. However this code is in spring-boot, not my code. I would prefer not to have to alter spring-boot code, but I am not sure what I should do in my code to prevent this exception.
I can see the offending jmsMessagingTemplate was added in the 1.2.0.M2 version. The naming of this is also misleading as I do not have JMS enabled in my app (although this is a RabbitMQ specific auto configuration file in spring-boot).
Any suggestions on how I can configure my code without eliminating templates or modifying spring-boot code?
I've created #1701 to track the naming issue. You should read rabbitMessagingTemplate there.
There are several auto configuration instances in Boot that requires certain types to be flagged with #Primary if they're not using the "default" name. For instance a JdbcTemplate is created for you automatically if none exists and a datasource is present. If you have more than one you should either name one dataSource or flag one of them as #Primary.
In your case, the messaging auto config for RabbitMQ expects one RabbitTemplate to be named rabbitTemplate or flag one of the three as #Primary.
This is annoying and we should do better. I've created #1702 for that.
Let me know if that works out for you. Thanks!

conflicts with existing, non-compatible bean definition of same name and class after proguard obfuscation

after Proguard obfuscation i get the following error :
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.lang.IllegalStateException: Annotation-specified bean name 'a'
for bean class [com.company.project.b.a.a.a] conflicts with existing,
non-compatible bean definition of same name and class
[com.company.project.a.a]
i'm using annotation based spring configuration , how can i avoid having two classes with the same name using Proguard because Spring doesn't allow two beans to have the same name.
I'm not sure if this is what you want, but you can specify bean name in #Component (and stereotypes #Repository, #Service and #Controller) value:
#Component("myBeanName")
public class MyBean {
}
I had the same problem and nothing else was helping out. Sometimes the problem occurs if you have moved your classes around and it refers to old classes, even if they don't exist.
In this case, just do this :
mvn eclipse:clean
mvn eclipse:eclipse
This worked well for me.
Another cause; you may have different versions of Spring in your classpath, for example, spring 2.x with spring 3.x. In such condition, beans seem to be loaded twice. If you use maven, check if a module does not import an old version of Spring (mvn dependency:tree) and remove it by excluding the involved spring artifact (exclusions).

Resources