The upgrade from spring-boot-starter-parent 3.3.4 to 3.3.4 breaks the entityManagerFactory bean configuration.

Using the sample app here: https://github.com/mkyong/spring-boot/tree/master/spring-data-jpa I upgraded the spring-boot-starter-parent version incrementally and version 3.3.3 worked as expected but 3.3.4 did not.

INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 46 ms. Found 1 JPA repository interface.
WARN  o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookService': Unsatisfied dependency expressed through field 'bookRepository': Error creating bean with name 'bookRepository' defined in com.mkyong.BookRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaSharedEM_entityManagerFactory' while setting bean property 'entityManager'
INFO  o.s.b.a.l.ConditionEvaluationReportLogger - 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
ERROR o.s.b.d.LoggingFailureAnalysisReporter - 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field bookRepository in com.mkyong.BookService required a bean named 'entityManagerFactory' 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 named 'entityManagerFactory' in your configuration.


Process finished with exit code 1

Comment From: philwebb

It appears to work for me:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.4)

INFO  com.mkyong.MainApplication - Starting MainApplication v1.0 using Java 20.0.1 with PID 70543 (/Users/pwebb/projects/spring-boot/samples/gh-43127/spring-boot/spring-data-jpa/target/spring-data-jpa-1.0.jar started by pwebb in /Users/pwebb/projects/spring-boot/samples/gh-43127/spring-boot/spring-data-jpa)
INFO  com.mkyong.MainApplication - No active profile set, falling back to 1 default profile: "default"
INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 19 ms. Found 1 JPA repository interface.
DEBUG com.zaxxer.hikari.HikariConfig - Driver class org.h2.Driver found in Thread context class loader org.springframework.boot.loader.launch.LaunchedClassLoader@6f496d9f
DEBUG com.zaxxer.hikari.HikariConfig - HikariPoolZZZ - configuration:
DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................true
DEBUG com.zaxxer.hikari.HikariConfig - catalog.........................none
DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............20000
DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>}
DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................."org.h2.Driver"
DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName......none
DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................600000
DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime...................0
DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold..........0
DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime.....................1800000
DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize.................5
DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry..................none
DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory...........none
DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle.....................5
DEBUG com.zaxxer.hikari.HikariConfig - password........................<masked>
DEBUG com.zaxxer.hikari.HikariConfig - poolName........................"HikariPoolZZZ"
DEBUG com.zaxxer.hikari.HikariConfig - readOnly........................false
DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans..................false
DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor...............none
DEBUG com.zaxxer.hikari.HikariConfig - schema..........................none
DEBUG com.zaxxer.hikari.HikariConfig - threadFactory...................internal
DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation............default
DEBUG com.zaxxer.hikari.HikariConfig - username........................"sa"
DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout...............5000
INFO  com.zaxxer.hikari.HikariDataSource - HikariPoolZZZ - Starting...
INFO  com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Added connection conn0: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA
INFO  com.zaxxer.hikari.HikariDataSource - HikariPoolZZZ - Start completed.
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Pool stats (total=1, active=0, idle=1, waiting=0)
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Added connection conn1: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - After adding stats (total=2, active=0, idle=2, waiting=0)
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Added connection conn2: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - After adding stats (total=3, active=0, idle=3, waiting=0)
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Added connection conn3: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA
INFO  o.s.o.j.p.SpringPersistenceUnitInfo - No LoadTimeWeaver setup: ignoring JPA class transformer
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - After adding stats (total=4, active=0, idle=4, waiting=0)
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Added connection conn4: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - After adding stats (total=5, active=0, idle=5, waiting=0)
INFO  o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default'
INFO  o.s.d.j.r.query.QueryEnhancerFactory - Hibernate is in classpath; If applicable, HQL parser will be used.
INFO  com.mkyong.MainApplication - Started MainApplication in 1.599 seconds (process running for 1.854)
INFO  com.mkyong.MainApplication - findAll(), expect 4 books
INFO  com.mkyong.MainApplication - -------------------------------
INFO  com.mkyong.MainApplication - Book{id=1, title='Book A', price=9.99, publishDate=2023-08-31}
INFO  com.mkyong.MainApplication - Book{id=2, title='Book B', price=19.99, publishDate=2023-07-31}
INFO  com.mkyong.MainApplication - Book{id=3, title='Book C', price=29.99, publishDate=2023-06-10}
INFO  com.mkyong.MainApplication - Book{id=4, title='Book D', price=39.99, publishDate=2023-05-05}
INFO  com.mkyong.MainApplication - 

INFO  com.mkyong.MainApplication - Book found with findById(1L):
INFO  com.mkyong.MainApplication - --------------------------------
INFO  com.mkyong.MainApplication - Book{id=1, title='Book A', price=9.99, publishDate=2023-08-31}
INFO  com.mkyong.MainApplication - 

INFO  com.mkyong.MainApplication - Book found with findByTitle('Book B')
INFO  com.mkyong.MainApplication - --------------------------------------------
INFO  com.mkyong.MainApplication - Book{id=3, title='Book C', price=29.99, publishDate=2023-06-10}
INFO  com.mkyong.MainApplication - 

INFO  com.mkyong.MainApplication - Book found with findByPublishedDateAfter(), after 2023/7/1
INFO  com.mkyong.MainApplication - --------------------------------------------
INFO  com.mkyong.MainApplication - Book{id=1, title='Book A', price=9.99, publishDate=2023-08-31}
INFO  com.mkyong.MainApplication - 

INFO  com.mkyong.MainApplication - Book{id=2, title='Book B', price=19.99, publishDate=2023-07-31}
INFO  com.mkyong.MainApplication - 

INFO  com.mkyong.MainApplication - Book delete where ID = 2L
INFO  com.mkyong.MainApplication - --------------------------------------------
INFO  com.mkyong.MainApplication - findAll() again, expect 3 books
INFO  com.mkyong.MainApplication - -------------------------------
INFO  com.mkyong.MainApplication - Book{id=1, title='Book A', price=9.99, publishDate=2023-08-31}
INFO  com.mkyong.MainApplication - Book{id=3, title='Book C', price=29.99, publishDate=2023-06-10}
INFO  com.mkyong.MainApplication - Book{id=4, title='Book D', price=39.99, publishDate=2023-05-05}
INFO  com.mkyong.MainApplication - 

INFO  o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
INFO  com.zaxxer.hikari.HikariDataSource - HikariPoolZZZ - Shutdown initiated...
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - Before shutdown stats (total=5, active=0, idle=5, waiting=0)
DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPoolZZZ - Closing connection conn0: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA: (connection evicted)
DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPoolZZZ - Closing connection conn1: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA: (connection evicted)
DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPoolZZZ - Closing connection conn2: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA: (connection evicted)
DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPoolZZZ - Closing connection conn3: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA: (connection evicted)
DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPoolZZZ - Closing connection conn4: url=jdbc:h2:mem:c94cea67-32a5-4672-93a3-22effe4b35f6 user=SA: (connection evicted)
DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPoolZZZ - After shutdown stats (total=0, active=0, idle=0, waiting=0)
INFO  com.zaxxer.hikari.HikariDataSource - HikariPoolZZZ - Shutdown completed.

Can you please provide your own sample and the steps needed to replicate the issue.

Comment From: vodanotech

I'm not sure why but after restarting IntelliJ and doing another full clean build it's decided to start working with no other changes. Sorry for any inconvenience caused.