How do I access a config file inside the jar?

前端 未结 4 902
暗喜
暗喜 2020-11-29 12:30

I\'m using FlatPack to parse and load data from flat files. This requires loading a config file that stores mappings of the columns of the flat file.

I have a const

4条回答
  •  清歌不尽
    2020-11-29 12:55

    If I remember correctly, getResourceAsStream() can behave differently depending on which web server your webapp is deployed, for instance I think it can be a problem when deployed as a war on a Websphere instance. But I'm not sure if this applies to you.

    But I'm not sure you're trying to solve the "proper" problem : if it's a config file, that means is data dependant right ? Not code dependant ( your jar ) ? When the flat file will change, your config file will need to change as well, right ? If this is true, it sounds like the config should be better stored elsewhere, or even passed as a parameter to your jar.

    But maybe I haven't fully understood your problem...

提交回复
热议问题