Reputation: 11
Details of the source code can be found at https://github.com/chikashishirozu/springboot-gradle-new_blog.
$ ./gradlew clean build --refresh-dependencies
BUILD SUCCESSFUL in 6s
4 actionable tasks: 1 executed, 3 up-to-date
$ ./gradlew bootRun
> Task :bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.4.1)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource
2025-01-21T12:37:51.844+09:00 ERROR 71559 --- [ restartedMain]
o.s.boot.SpringApplication : Application run failed
2025-01-21T12:37:50.451+09:00 DEBUG 71559 --- [ restartedMain]
o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean
'preserveErrorControllerTargetClassPostProcessor'
2025-01-21T12:37:51.744+09:00 WARN 71559 --- [ restartedMain]
ConfigServletWebServerApplicationContext : Exception encountered during context
initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Failed to initialize dependency 'flywayInitializer' of LoadTimeWeaverAware bean
'entityManagerFactory': Error creating bean with name 'flywayInitializer' defined in
class path resource
2025-01-21T12:37:50.747+09:00 DEBUG 71559 --- [ restartedMain]
o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean
'errorPageCustomizer'
2025-01-21T12:37:50.747+09:00 DEBUG 71559 --- [ restartedMain]
o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean
'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration'
2025-01-21T12:37:50.748+09:00 DEBUG 71559 --- [ restartedMain]
o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name
'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration'
via constructor to bean named 'server-
org.springframework.boot.autoconfigure.web.ServerProperties'
2025-01-21T12:37:50.780+09:00 DEBUG 71559 --- [ restartedMain]
o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name
'errorPageCustomizer' via factory method to bean named
'dispatcherServletRegistration'
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Failed to initialize dependency 'flywayInitializer' of LoadTimeWeaverAware bean
'entityManagerFactory': Error creating bean with name 'flywayInitializer' defined in
class path resource
ErrorMvcAutoConfiguration matched:
- @ConditionalOnClass found required classes 'jakarta.servlet.Servlet',
'org.springframework.web.servlet.DispatcherServlet' (OnClassCondition)
- found 'session' scope (OnWebApplicationCondition)
ErrorMvcAutoConfiguration#basicErrorController matched:
- @ConditionalOnMissingBean (types:
org.springframework.boot.web.servlet.error.ErrorController; SearchStrategy: current)
did not find any beans (OnBeanCondition)
ErrorMvcAutoConfiguration#errorAttributes matched:
- @ConditionalOnMissingBean (types:
org.springframework.boot.web.servlet.error.ErrorAttributes; SearchStrategy: current)
did not find any beans (OnBeanCondition)
ErrorMvcAutoConfiguration.DefaultErrorViewResolverConfiguration#conventionErrorViewResolver matched: - @ConditionalOnBean (types: org.springframework.web.servlet.DispatcherServlet; SearchStrategy: all) found bean 'dispatcherServlet'; @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition) ErrorMvcAutoConfiguration.DefaultErrorViewResolverConfiguration#conventionErrorViewResolver matched: - @ConditionalOnBean (types: org.springframework.web.servlet.DispatcherServlet; SearchStrategy: all) found bean 'dispatcherServlet'; @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)
ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration: Did not match: - ErrorTemplate Missing found template from org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider@1f553ae9 (ErrorMvcAutoConfiguration.ErrorTemplateMissingCondition) Matched: - @ConditionalOnProperty (server.error.whitelabel.enabled) matched (OnPropertyCondition)
ErrorWebFluxAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class
'org.springframework.web.reactive.config.WebFluxConfigurer' (OnClassCondition)
WebMvcAutoConfiguration.ProblemDetailsErrorHandlingConfiguration:
Did not match:
- @ConditionalOnProperty (spring.mvc.problemdetails.enabled=true) did not find
property 'enabled' (OnPropertyCondition)
2025-01-21T12:37:51.844+09:00 ERROR 71559 --- [ restartedMain]
o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Failed to initialize dependency 'flywayInitializer' of LoadTimeWeaverAware bean
'entityManagerFactory': Error creating bean with name 'flywayInitializer' defined in
class path resource
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'flywayInitializer' defined in class path resource
BUILD SUCCESSFUL in 6s
4 actionable tasks: 1 executed, 3 up-to-date
build.gradle
plugins {
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
}
test {
java {
srcDirs = ['src/test/java']
}
}
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-authorization-server'
implementation 'org.springframework.boot:spring-boot-starter-graphql'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation 'org.springframework.boot:spring-boot-starter-groovy-templates'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.flywaydb:flyway-core:11.1.0'
implementation 'org.mariadb.jdbc:mariadb-java-client'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'com.h2database:h2'
implementation 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.mockito:mockito-core:3.6.28'
testImplementation 'org.mockito:mockito-junit-jupiter:3.6.28'
testImplementation 'org.testng:testng:7.5'
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
tasks.withType(Test) {
enabled = true
}
Upvotes: -1
Views: 30