Hi All,
I am trying to incorporate OWNER in my app.
But try as I may I am only able to return only fields with defaltvalue annotations.
All others return null.
Below is the last attempt.
ServerConfig.properties File Content
serverPort=9898
dbDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
dbUserName=MetaDev
dbPassword=masterkey
dbURL=jdbc:sqlserver://127.0.0.1:1433;databaseName=MetaDevDB
appContext=metapaymentsgateway
Interface Class
public interface ServerConfig extends Config
{
//@DefaultValue("9898")
Integer serverPort();
//@DefaultValue("metapaymentsgateway")
String appContext();
String dbDriverClassName();
String dbUserName();
String dbPassword();
String dbURL();
}
Simple Test
@Test
public void testGetServerPort()
ServerConfig cfg = ConfigFactory.create(ServerConfig.class);
Assert.assertEquals(9898,(int)cfg.serverPort());
}
The Test Method above fails if I comment out the default value annotation.
Can any one tell me what is wrong ?
My preferred config file format is to use server.port , database.url etc.
Any help will be highly appreciated.
Thanks