After i added dependencies of spring state machine my entities seen as not managed type. After adding @EntityScan annotation and tell Spring where to find entities used in our application, spring recognized my entities again. I am using following dependencies of spring state machine.
<dependency>
<groupId>org.springframework.statemachine</groupId>
<artifactId>spring-statemachine-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.statemachine</groupId>
<artifactId>spring-statemachine-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.statemachine</groupId>
<artifactId>spring-statemachine-data-jpa</artifactId>
</dependency>
I think spring-statemachine-data-jpa is where the problem comes from. At documentation to get rid of any configuration problem they are using spring-statemachine-autoconfigure and @SpringBootApplication annotation is enough to start application. But i am using spring-boot-starter-data-jpa to working on my database model.
Am i missing something about spring state machine? After adding @EntityScan everything working without problem but i am wondering what happened and auto scan was broken.
I think you're right. I had the same problem after including spring-statemachine-data-jpa dependency to my project.
Not sure what is the root cause, it seems like repository component scan from the lib is taking precedence.
To solve the problem, I manually mapped the unmapped repositories, by adding these to my main class
@EntityScan(basePackages = "name.your.package")
@EnableJpaRepositories(basePackages = "name.your.package")
and setting this flag for bean overriding to true
spring.main.allow-bean-definition-overriding=true