I have a problem to run my Spring Boot with the usage of Jpastreamer. I cannot solve the bean issue related with Jpastreamer.
Here is the PersonService shown below
@Service
@RequiredArgsConstructor
public class PersonService {
private final JPAStreamer jpaStreamer;
private final PersonRepository personRepository;
...
}
I got this issue shown below when I run the application.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in com.springboot.jpastreamer.service.PersonService 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.
Process finished with exit code 0
Here is the repo shown below
After defining JPAStreamer
as a bean
in JPAStreamerConfig
shown below, the issue disappeared.
import com.speedment.jpastreamer.application.JPAStreamer;
import jakarta.persistence.EntityManagerFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@RequiredArgsConstructor
public class JPAStreamerConfig {
private final EntityManagerFactory entityManagerFactory;
@Bean
public JPAStreamer jpaStreamer() {
return JPAStreamer.of(entityManagerFactory);
}
}