EVENT id=startup-40 ns=25528567527666 thread=blog.spring.boot.Chapter40.main() startup.failed BeanCreationException
2026-10-02T17:32:09.570+08:00 ERROR 72132 --- [hapter40.main()] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'broken' defined in blog.spring.boot.Chapter40$Broken: Failed to instantiate [java.lang.String]: Factory method 'broken' threw exception with message: synthetic-boot-failure-40
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:489) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1375) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1205) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:569) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:529) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:339) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:373) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1221) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1187) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1123) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:987) ~[spring-context-6.2.11.jar:6.2.11]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.2.11.jar:6.2.11]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.5.6.jar:3.5.6]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.5.6.jar:3.5.6]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.5.6.jar:3.5.6]
	at blog.spring.boot.Chapter40.main(Chapter40.java:131) ~[classes/:na]
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:279) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.String]: Factory method 'broken' threw exception with message: synthetic-boot-failure-40
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:200) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiateWithFactoryMethod(SimpleInstantiationStrategy.java:89) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:169) ~[spring-beans-6.2.11.jar:6.2.11]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-6.2.11.jar:6.2.11]
	... 20 common frames omitted
Caused by: java.lang.IllegalStateException: synthetic-boot-failure-40
	at blog.spring.boot.Chapter40$Broken.broken(Chapter40.java:52) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:172) ~[spring-beans-6.2.11.jar:6.2.11]
	... 23 common frames omitted

PASS startup failure identifies bean
PASS ApplicationFailedEvent observed once
EVENT id=synthetic-40 ns=25529867964208 thread=http-nio-127.0.0.1-auto-1-exec-1 observation.start
EVENT id=synthetic-40 ns=25529879550333 thread=http-nio-127.0.0.1-auto-1-exec-1 connection.acquired backend=72457 active=1
EVENT id=synthetic-40 ns=25529886477541 thread=pool-2-thread-1 sql.start backend=72457 sql=select pg_sleep(0.3) /* synthetic-40 */
EVENT id=synthetic-40 ns=25529899261750 thread=http-nio-127.0.0.1-auto-1-exec-1 server.wait backend=72457 type=Timeout event=PgSleep sql=select pg_sleep(0.3) /* synthetic-40 */
PASS independent session sees correlated PostgreSQL PgSleep
EVENT id=synthetic-40 ns=25530191221250 thread=pool-2-thread-1 sql.end backend=72457
PASS slow SQL completes
PASS pool wait visible while sole connection held
EVENT id=synthetic-40 ns=25530194231041 thread=http-nio-127.0.0.1-auto-1-exec-1 pool.wait active=1 waiting=1
EVENT id=synthetic-40 ns=25530499151708 thread=pool-2-thread-2 pool.timeout SQLTransientConnectionException
PASS bounded pool wait times out
EVENT id=synthetic-40 ns=25530499415916 thread=http-nio-127.0.0.1-auto-1-exec-1 pool.wait.duration.ns=307850583
PASS executor first task running
EVENT id=synthetic-40 ns=25530501266583 thread=http-nio-127.0.0.1-auto-1-exec-1 executor.rejected active=1 queued=1
EVENT id=synthetic-40 ns=25530501382125 thread=pool-3-thread-1 queued.task.completed
PASS executor terminates and queued task drains
EVENT id=synthetic-40 ns=25530503071875 thread=http-nio-127.0.0.1-auto-1-exec-1 transaction.rollback backend=72457
PASS no remaining connection waiters
EVENT id=synthetic-40 ns=25530508477583 thread=http-nio-127.0.0.1-auto-1-exec-1 observation.stop error=null
PASS real Boot Tomcat HTTP request completes
PASS Actuator exposes completed HTTP observation metric
METRICS {"name":"http.server.requests","baseUnit":"seconds","measurements":[{"statistic":"COUNT","value":1.0},{"statistic":"TOTAL_TIME","value":0.662887125},{"statistic":"MAX","value":0.662887125}],"availableTags":[{"tag":"exception","values":["none"]},{"tag":"method","values":["GET"]},{"tag":"error","values":["none"]},{"tag":"uri","values":["/evidence"]},{"tag":"outcome","values":["SUCCESS"]},{"tag":"status","values":["200"]}]}
PASS custom ObservationHandler receives one completed order observation
PASS request returns connection to pool
PASS startup timeline contains bean instantiation steps
STARTUP events=341
PASS independent business read proves rollback despite HTTP 200
PASS context close shuts Hikari pool
PASS HTTP port closed after context shutdown
CHAPTER 40 PASS
