why Spring boot 2.4.3 has migration issues related entityManagerFactory bean - spring

I had a working application using spring boot 1.5.9
After i upgrade spring boot to latest 2.4.3, facing issues with
an interface with #Reposiroty - required a bean of type testRepository
then added #EnableJPAConfiguration to bootRunner got below error
required a bean named 'entityManagerFactory' that could not be found
If i a write LocalContainerEntityManagerFactoryBean bean with dataSource configuration, i could see the application starts.
I dont really see these details from this Migration Guide
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide
Kindly Please help me understanding this puzzle. Thank you.

Related

springboot app looking for GenericResponseService bean

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

How to initialize OpenApiResource bean in spring context?

I updated dependencies
org.springdoc:springdoc-openapi-ui
org.springdoc:springdoc-openapi-common
org.springdoc:springdoc-openapi-webmvc-core
org.springdoc:springdoc-openapi-webflux-core
from version 1.6.9 to 1.6.11. And now bean of class org.springdoc.webmvc.api.OpenApiResource doesn't initialize well.
I found that it should have been created in SpringDocWebMvcConfiguration.class, however I discovered that SpringDocWebMvcConfiguration.class didn't initialize itself after update of springdoc version, but on previous version it was initializing well. The only change they made in a new version of springdoc is annotation:
#ConditionalOnBean(SpringDocConfiguration.class)
on SpringDocWebMvcConfiguration, so it depends on SpringDocConfiguration.class. I printed all beans from my spring context by calling
context.getBeanDefinitionNames()
and figured out that context contains SpringDocConfiguration bean, but not SpringDocWebMvcConfiguration. May be somebody already had same issue and can help me?

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.

circular dependency error for dataSource after adding spring DATA JPA

I am working in spring boot security with Oauth2. Oauth2 to makes use of jdbcAuthentication in AuthorizationServerConfigurerImpl. But in my webSecurityCofigurer implementing class i want to use Spring data JPA to implement userDetailsService. After enabling #EnableJpaRepositories it is throwing circular depenency error and not able to load dataSource which i am defining in AuthorizationServerConfigurerImpl.
Please help me resolving issue

Spring Boot JPA CrudRepository

I'm working with Spring Boot + Spring Data JPA and facing this problem when trying to inject a class that extends CrudRepository:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'topicRepository': Could not resolve
matching constructor (hint: specify index/type/name arguments for
simple parameters to avoid type ambiguities)
Repository Class:
public interface TopicRepository extends CrudRepository<Topic, Integer> {}
Service Class:
#Service
public class TopicService {
#Autowired
private TopicRepository topicRepository;
}
Any suggestions?
I was having the same issue, and I fixed it by switching Spring Boot versions. Changing the Spring Data JPA versions did nothing (this is where I assumed the bug would be), so I think there is a bug in Spring Boot version 1.5.1. I switched back to version 1.4.3 and the error was gone. I didn't try subsequent/different versions, so you may just have to experiment with your dependencies and their versions.
For the record, you can have your service class annotated with #Repository, it shouldn't make any difference. I've been setting these apps up the same way using the service/dao pattern, and it has never been too picky with the annotations. Hopefully this may help others whose Spring Boot development flow suddenly throws an error!
Which versions of spring-data-commons and spring-data-jpa are you using. I just ran into this using spring-data-commons 1.13.x with spring-data-jpa 1.10.x. Upgrading spring-data-jpa to 1.11.x fixed the issue for me.
I too had the same issue after updating Spring Boot to 1.5.4.
I am also using spring-data-envers, which was at version 1.0.4. Upgrading to 1.4.1 solved the problem.
I hope it helps someone :)
Make sure:
1) TopicRepository is annotated with #Repository.
2) You have the scanning packages configured:
<jpa:repositories base-package="mypkg.repositories"></jpa:repositories>
Had the same issue on 1.5.2. Upgrading to 1.5.5 solved the problem.
You can use Applicationcontext to inject repository to this reference topicRepository..
You just declare applicationcontext in #rest controller class
Same like topicRepository by using annotation. Then you pass this to the service class which should take parms through constructor.
Ex-
public TopicService(Applicationcontext ctx) {this.topicRepository =context.getBean(TopicRepository.class);
}

Resources