Giter Site home page Giter Site logo

spring-tips / spring-boot-3-aot Goto Github PK

View Code? Open in Web Editor NEW
87.0 9.0 16.0 33.73 MB

Hi, Spring fans! In this installment we briefly look at some of the new support for building native applications in Spring Framework 6 and Spring Boot 3

License: Apache License 2.0

Java 13.89% Shell 0.45% HTML 85.66%

spring-boot-3-aot's Issues

images in README.adoc are broken

While yesterday all the image in README.adoc were show just perfectly, today they are not, why is that ?
I refer to for instance :
image::{root}/images/reachability-metadata.png[]
which now show like this:
Bildschirmfoto 2022-12-16 um 09 44 25

Windows issue?

First of all, thanks for these examples - they have been really helpful.

I am experiencing an error when running the compiled .exe on Windows, linked to the scopes example.
(VS2022 Native Tools and GraalVM 22.3.0)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v3.0.0-SNAPSHOT)

2022-11-24T13:13:47.424Z  INFO 19812 --- [           main] com.example.aot.AotApplication           : Starting AOT-processed AotApplication using Java 17.0.5 with PID 19812 (C:\Users\AUser\Projects\workspace\java\spring-boot-3-aot\target\aot.exe started by AUser in C:\Users\AUser\Projects\workspace\java\spring-boot-3-aot\target)
2022-11-24T13:13:47.425Z  INFO 19812 --- [           main] com.example.aot.AotApplication           : No active profile set, falling back to 1 default profile: "default"
2022-11-24T13:13:47.434Z  INFO 19812 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'proxiesConfiguration' of type [com.example.aot.bpp.proxies.ProxiesConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-11-24T13:13:47.484Z  INFO 19812 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-11-24T13:13:47.484Z  INFO 19812 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-24T13:13:47.484Z  INFO 19812 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-11-24T13:13:47.492Z  INFO 19812 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-24T13:13:47.493Z  INFO 19812 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 68 ms
2022-11-24T13:13:47.508Z  WARN 19812 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextHttpController': Instantiation of supplied bean failed
2022-11-24T13:13:47.508Z  INFO 19812 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-11-24T13:13:47.509Z ERROR 19812 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextHttpController': Instantiation of supplied bean failed
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1236) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1210) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1157) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[aot.exe:6.0.1]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[aot.exe:6.0.1]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[aot.exe:6.0.1]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[aot.exe:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[aot.exe:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[aot.exe:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[aot.exe:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[aot.exe:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[aot.exe:3.0.0-SNAPSHOT]
        at com.example.aot.AotApplication.main(AotApplication.java:10) ~[aot.exe:na]
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class com.example.aot.scopes.RequestContext: Common causes of this problem include using a final class or a non-visible class
        at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:216) ~[aot.exe:6.0.1]
        at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:158) ~[aot.exe:6.0.1]
        at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[na:na]
        at org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver.buildLazyResolutionProxy(ContextAnnotationAutowireCandidateResolver.java:143) ~[na:na]
        at org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver.buildLazyResolutionProxy(ContextAnnotationAutowireCandidateResolver.java:84) ~[na:na]
        at org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver.getLazyResolutionProxyIfNecessary(ContextAnnotationAutowireCandidateResolver.java:54) ~[na:na]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1322) ~[aot.exe:6.0.1]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArgument(BeanInstanceSupplier.java:334) ~[na:na]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.resolveArguments(BeanInstanceSupplier.java:271) ~[na:na]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:206) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1225) ~[aot.exe:6.0.1]
        ... 18 common frames omitted
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->com.example.aot.scopes.RequestContext$$SpringCGLIB$$0.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
        at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:506) ~[na:na]
        at org.springframework.cglib.proxy.Enhancer.wrapCachedClass(Enhancer.java:801) ~[na:na]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:114) ~[na:na]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:111) ~[na:na]
        at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:55) ~[na:na]
        at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[aot.exe:na]
        at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:62) ~[na:na]
        at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:35) ~[na:na]
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:137) ~[na:na]
        at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:322) ~[aot.exe:6.0.1]
        at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:567) ~[na:na]
        at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:412) ~[na:na]
        at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:62) ~[na:na]
        at org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:213) ~[aot.exe:6.0.1]
        ... 28 common frames omitted
Caused by: java.lang.NoSuchMethodException: com.example.aot.scopes.RequestContext$$SpringCGLIB$$0.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
        at [email protected]/java.lang.Class.getDeclaredMethod(DynamicHub.java:2675) ~[aot.exe:na]
        at org.springframework.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java:907) ~[na:na]
        at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:495) ~[na:na]
        ... 41 common frames omitted

Is there a hint I might be missing?
Thanks.

Request: Full DataDog tracing guide

Hi @joshlong

Hope it's ok to put this request here.

I'd really, really appreciate if you could add something to this guide on how to correctly setup monitoring and distributed tracing such that it works on an AOT build of Spring Boot 3 and can be sent to DataDog.

I've had nothing but bother trying to get this to work, and there are no useful guides or documentation that conclusively show how to do this. (some are too old, some reference different libraries, some use zipkin (which I don't want))
Thanks

XML Configuration is not picked in native image.

I created a simple spring boot web application which uses applicationContext.xml to define a bean. The application runs fine on jvm and serves a simple hello user message on rest call. But when I convert this application to spring boot native image it fails to run because it cannot find this bean defined in the applicationContext.xml. I used @ImportResource("applicationContext.xml") to read the context file. The xml is placed in src/main/resources folder. It seems that spring native image cannot read the xml file and completely ignores it.
I have build the image using native build tools with GraalVM distribution.
Can you please help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.