Skip to content
Advertisement

How to get the value from system property in spring boot

I am using following command to run my spring boot application

JavaScript

Currently, I am able to access it via following command like below

JavaScript

However I need to access it via any annotation in Spring something like

@value(${library.system.property})

I tried to use

JavaScript

But the value of the property is null. Do I need to use conditional bean or something?

Advertisement

Answer

Thanks all. Issue got resolved by changing the way of passing the argument through command line as below

JavaScript

Accessing the value by below code snippet

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement