Mustafa zuhair
Mustafa zuhair

Reputation: 5

JPAStreamer not working with spring boot 3

I have project with spring boot version 3.0.2 and there is a lot of queries and join statements while i try to use JPAStreamer library in project it's doesn't support spring boot 3 is there any solution or other library to perform queries easily without jpql or jpa

i try with new project spring boot version 2.x and it' work but i can't go back to version 2.x also in spring boot version 3.x doesn't show JPAStreamer banner or create classes in target folder sample of code

`

private  JPAStreamer jpaStreamer;

public List<Employee> getEmployees(int offset,int limit){
    return jpaStreamer.stream(Employee.class)
            .sorted(Employee$.name)
            .skip(offset)
            .limit(limit)
            .collect(Collectors.toList());
}

` and i got this error

`2023-03-28T00:07:59.968+03:00 WARN 19084 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'service': No qualifying bean of type 'com.javatechie.jpastreamer.service.EmployeeService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2023-03-28T00:07:59.970+03:00 INFO 19084 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2023-03-28T00:07:59.982+03:00 INFO 19084 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2023-03-28T00:08:00.048+03:00 INFO 19084 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2023-03-28T00:08:00.062+03:00 INFO 19084 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2023-03-28T00:08:00.189+03:00 INFO 19084 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2023-03-28T00:08:00.381+03:00 ERROR 19084 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Field service in com.javatechie.jpastreamer.controller.EmployeeController required a bean of type 'com.javatechie.jpastreamer.service.EmployeeService' that could not be found.

The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'com.javatechie.jpastreamer.service.EmployeeService' in your configuration.

Process finished with exit code 1 `

Upvotes: 0

Views: 723

Answers (3)

Lino Sebastian
Lino Sebastian

Reputation: 1

 ***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.Sample... required a bean
of type 'com.speedment.jpastreamer.application.JPAStreamer' that could not be found.
Action:
Consider defining a bean of type 'com.speedment.jpastreamer.application.JPAStreamer' in your configuration


Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'com.spe
edment.jpastreamer.application.JPAStreamer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annota
tions: {}

Solution worked for me

@SpringBootApplication(scanBasePackages={"com.speedment.jpastreamer"})

I was using Spring boot 3.0.2 with Java 17

Upvotes: 0

Julia Gustafsson
Julia Gustafsson

Reputation: 3

JPAStreamer does support Hibernate 6 and Spring Boot 3 since version 3.0.0. See https://github.com/speedment/jpa-streamer/releases/tag/3.0.0.

Upvotes: 0

Franco Arratia
Franco Arratia

Reputation: 44

It seems an issue with new springboot version. But it is already reported https://github.com/speedment/jpa-streamer/issues/333#issuecomment-1572106573

However the solution seems to be explicitly scanning for jpastreamer, so here the example that worked for me:

@SpringBootApplication(scanBasePackages={"com.your.root.projectpackage", "com.speedment.jpastreamer"})

Upvotes: 1

Related Questions