Reputation: 16151
History
In my project i have around 50 JpaRepositories. Most of them are in the main web app WAR. A few are in 6 external JARs which are compiled into tha main WAR. My Application Server is Wildfly 8.2.0 Final. I foudn out today in the logs that creating Spring beans from JPA Repositories takes on my machine 20 seconds. I have an not so old i5 and an SSD. I have Spring 4.2 and Spring Data JPA 1.9.4.
Question
This is way too long. Anyone knows how to speed up bean creation for Spring Data JPA Repositories or at what mistakes to look for?
Additional Info
I configured the Spring Data JPA as follows:
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"pl.company"}, entityManagerFactoryRef = "myEmf")
@ComponentScan(basePackages = {"pl.company"})
public class PersistenceJPAConfig {
Here are the logs from Wildfly 8.2.0:
https://gist.github.com/anonymous/540c79a4e8456a28aa52a2ea640553b0
The repeating fragment which takes so long:
14:30:13,930 DEBUG [org.springframework.core.env.StandardEnvironment] (MSC service thread 1-3) Adding [systemProperties] PropertySource with lowest search precedence
14:30:13,930 DEBUG [org.springframework.core.env.StandardEnvironment] (MSC service thread 1-3) Adding [systemEnvironment] PropertySource with lowest search precedence
14:30:13,930 DEBUG [org.springframework.core.env.StandardEnvironment] (MSC service thread 1-3) Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
14:30:13,930 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] (MSC service thread 1-3) Resolved classpath location [pl/company/] to resources [URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/classes/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/energetyka-coretypes-1.1.2-umarsz.jar/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/energetyka-wicket-components-1.0.4-umarsz-SNAPSHOT.jar/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/licensing-1.0.8.jar/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/reports-1.0.7-SNAPSHOT.jar/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/system-parameters-1.2.1.jar/pl/company/], URL [vfs:/C:/Java/wildfly-8.2.0.Final/bin/content/BDOS.war/WEB-INF/lib/wicketWebComponents-1.0-SNAPSHOT.jar/pl/company/]]
14:30:14,295 DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] (MSC service thread 1-3) Resolved location pattern [classpath*:pl/company/**/*GokCommunity2016Table4RepositoryImpl.class] to resources []
14:30:14,296 DEBUG [org.springframework.data.repository.config.RepositoryConfigurationDelegate] (MSC service thread 1-3) Spring Data JPA - Registering repository: gokCommunity2016Table4Repository - Interface: pl.company.zaprogs.web.statements.repository.gok2016.communityStatement.GokCommunity2016Table4Repository - Factory: org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean
Upvotes: 2
Views: 2120
Reputation: 16151
Solved it by upgrading Spring Data JPA from 1.9.4 to 1.11.10. This particular part executes now in 3 instead of 52 seconds.
Upvotes: 0