2

In application.properties:

app.lazy_init=true

and in Main class :

@ComponentScan(lazyInit = "${app.lazy_init: false}")
public class Main(){...}

But the lazyInit is a Boolean, how can I convert a String to a Boolean in @ComponentScan::lazyInit?

Draken
  • 3,134
  • 13
  • 34
  • 54
viewking
  • 675
  • 1
  • 6
  • 8

1 Answers1

0

You can't. lazyInit is typed as a boolean so the value that you configure it with has to be a boolean at compile time. In other words, there's no opportunity for converting the String to a boolean as that conversion has to be performed at runtime.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242