properties file in web app

前端 未结 1 1159
感动是毒
感动是毒 2020-12-21 09:34

First, there are a lot of solutions out there and I have already read a lot of them. But for some reason I don\'t get it working.

I am trying to outsource my config

相关标签:
1条回答
  • 2020-12-21 09:59

    Take out from META-INF , put it in src/config direct to config package in source , upon build it will go to /WEB-INF/classes/config/config.properties

    and this.getClass().getResourceAsStream("/config/config.properties");

    Update enter image description here

    and then I created a Service Class in the same project which has a method.

    public static InputStream getConfigAsInputStream(){
        return Service.class.getResourceAsStream("/config/config.properties");
    }
    

    This works..!!

    Compare yours

    0 讨论(0)
提交回复
热议问题