Java .properties files as strongly typed classes

后端 未结 8 1181
小蘑菇
小蘑菇 2021-01-02 14:50

Is there way to get properties files as strongly typed classes? I guess there are code generators but doing it with annotations would be much cooler.

What I mean is;

8条回答
  •  旧巷少年郎
    2021-01-02 15:10

    There is a somewhat similar project for doing configuration as statically typed files. It requires to declare an interface, but it fills in the implementation itself:

    public interface AppConfig extends Config {
        long getTimeout ();
        URL getURL ();
        Class getHandlerClass ();
    }
    

提交回复
热议问题