You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately my custom factory causes NoSuchMethodException when I build my application into a Spring Native image and then run it.
2023-03-23T09:49:07.586Z ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to instantiate class com.example.demo.config.YamlPropertySourceFactory
at org.springframework.core.io.support.PropertySourceProcessor.instantiateClass(PropertySourceProcessor.java:146) ~[na:na]
at org.springframework.core.io.support.PropertySourceProcessor.processPropertySource(PropertySourceProcessor.java:81) ~[na:na]
at com.example.demo.DemoApplication__ApplicationContextInitializer.processPropertySources(DemoApplication__ApplicationContextInitializer.java:46) ~[com.example.demo.DemoApplication:na]
at com.example.demo.DemoApplication__ApplicationContextInitializer.initialize(DemoApplication__ApplicationContextInitializer.java:33) ~[com.example.demo.DemoApplication:na]
at com.example.demo.DemoApplication__ApplicationContextInitializer.initialize(DemoApplication__ApplicationContextInitializer.java:27) ~[com.example.demo.DemoApplication:na]
at org.springframework.context.aot.AotApplicationContextInitializer.initialize(AotApplicationContextInitializer.java:72) ~[com.example.demo.DemoApplication:6.0.6]
at org.springframework.context.aot.AotApplicationContextInitializer.lambda$forInitializerClasses$0(AotApplicationContextInitializer.java:61) ~[com.example.demo.DemoApplication:6.0.6]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:605) ~[com.example.demo.DemoApplication:3.0.4]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:385) ~[com.example.demo.DemoApplication:3.0.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:309) ~[com.example.demo.DemoApplication:3.0.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[com.example.demo.DemoApplication:3.0.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[com.example.demo.DemoApplication:3.0.4]
at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[com.example.demo.DemoApplication:na]
Caused by: java.lang.NoSuchMethodException: com.example.demo.config.YamlPropertySourceFactory.<init>()
at [email protected]/java.lang.Class.getConstructor0(DynamicHub.java:3585) ~[com.example.demo.DemoApplication:na]
at [email protected]/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2754) ~[com.example.demo.DemoApplication:na]
at org.springframework.core.io.support.PropertySourceProcessor.instantiateClass(PropertySourceProcessor.java:141) ~[na:na]
... 12 common frames omitted
Please refer to spring-native-issues repo with a complete demo. Please make sure you're using property-source branch of the repo.
The text was updated successfully, but these errors were encountered:
I have a custom YAML resource that should be mapped to a Java property class. I used to do this using the following approach:
where
YamlPropertySourceFactory
is pretty simple:Unfortunately my custom factory causes
NoSuchMethodException
when I build my application into a Spring Native image and then run it.Please refer to spring-native-issues repo with a complete demo. Please make sure you're using
property-source
branch of the repo.The text was updated successfully, but these errors were encountered: