Skip to content

How to pass arguments into a Spring boot run?

To pass arguments when you are running a Spring Boot application you can simply assign your parameters to

mvn spring-boot:run"--params.filename=employees --params.clientId=asana"

To retrieve these params and use them in your code, declare them in with dummy values and autowire them with @Value in your actual code.

    private String fileName;

    private String date;

    private String clientId;

    private String featureId;

See also  Java String split() Method

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.