Coder Social home page Coder Social logo

Comments (4)

scottfrederick avatar scottfrederick commented on June 18, 2024

@patbaumgartner It's not clear to me what you are trying to do. The CDS_TRAINING_JAVA_TOOL_OPTIONS environment variable can be configured on the spring-boot:build-image goal and passed to the Paketo Spring Boot buildpack. It should have no effect on the spring-boot:run goal, so I don't see how it could interfere with setting spring-boot.run.arguments on spring-boot:run.

Can you provide a more complete example of your pom.xml, the mvn commands you are running, and the behavior you expect?

from spring-boot.

patbaumgartner avatar patbaumgartner commented on June 18, 2024

Hi @scottfrederick

my main goal was to use App CDS with the spring-boot-maven plugin as it is described in the Buildpacks documentation. I realized that the parameter CDS_TRAINING_JAVA_TOOL_OPTIONS gets passed as JAVA_TOOL_OPTIONS successfully and was ignored. So I tried to find out where the issue might be.

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-aot</id>
                        <goals>
                            <goal>process-aot</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <image>
                        <env>
                            <BP_SPRING_AOT_ENABLED>true</BP_SPRING_AOT_ENABLED>
                            <BP_JVM_CDS_ENABLED>true</BP_JVM_CDS_ENABLED>
                            <CDS_TRAINING_JAVA_TOOL_OPTIONS>-Dtelegrambots.enabled=false</CDS_TRAINING_JAVA_TOOL_OPTIONS>
                        </env>
                    </image>
                </configuration>
            </plugin>

Then I tried to run the app with java -Dtelegrambots.enabled=true -jar my.jar and it worked. Next step was the maven plugin which I got wrong above. It should have been mvn spring-boot:run -Dspring-boot.run.arguments="-Dreproducer.enabled=true" which passes the args to the app.

After that I realized that when adding -Dspring.context.exit=onRefresh my enabling property gets ignored. It doesn't matter if I do it via maven, buildpacks or java -jar.

I remember that I saw somewhere @sdeleuze used spring.flyway.enabled=false of FlywayAutoConfiguration for a training run but since the property gets ignored, it would not work as expected, which means to not creating a DB connection and migrating the data.

Since this is a pretty new feature, there is not much documentation and answers on SO. I hope you could follow my thoughts.

Best,
Patrick

from spring-boot.

mhalbritter avatar mhalbritter commented on June 18, 2024

spring-boot.run.arguments are for arguments to the main class. I think jvmArguments is what you're looking for?

from spring-boot.

sdeleuze avatar sdeleuze commented on June 18, 2024

FYI I did a quick test on aarch64 with the buildpacks branch of petclinic-efficient-container. If I remove spring.data.jdbc.dialect=postgresql from application.properties, the application training run fails as expected because it tries to connect to the database when building the container.

If I bring it back in the Spring Boot Maven configuration, it works again:

                <configuration>
                    <image>
                        <env>
                            <BP_SPRING_AOT_ENABLED>true</BP_SPRING_AOT_ENABLED>
                            <BP_JVM_CDS_ENABLED>true</BP_JVM_CDS_ENABLED>
                            <CDS_TRAINING_JAVA_TOOL_OPTIONS>-Dspring.data.jdbc.dialect=postgresql</CDS_TRAINING_JAVA_TOOL_OPTIONS>
                        </env>
                    </image>
                </configuration>

I did another test on x86 without the Spring Framework version customization, builder and image customization, it works as well. So the feature seems to work as expected with Buildacks. For Spring Boot run, the configuration is done differently as pointed out by @scottfrederick and @mhalbritter.

from spring-boot.

Related Issues (20)

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.