how to define not mandatory property in spring?

前端 未结 2 1900
孤城傲影
孤城傲影 2020-12-14 15:10

I\'m using spring 3 with PropertyPlaceholderConfigurator.

My properties code looks like as following:

@Configuration
public class MyProps {

    @Val         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 15:51

    I'm not sure if it is possible to make a single property optional but surely you can force the property placeholder to ignore unresolved properties:

    
    

提交回复
热议问题