mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1583 - ENH: Add type safe ServerConfig getServiceObject(Class<P> cls) and putServiceObject()
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.ebean.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
@@ -121,4 +122,19 @@ public class ServerConfigTest {
|
||||
serverConfig.setIdGeneratorAutomatic(false);
|
||||
assertFalse(serverConfig.isIdGeneratorAutomatic());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_putServiceObject() {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
ServerConfig config = new ServerConfig();
|
||||
config.putServiceObject(objectMapper);
|
||||
|
||||
ObjectMapper mapper0 = config.getServiceObject(ObjectMapper.class);
|
||||
ObjectMapper mapper1 = (ObjectMapper)config.getServiceObject("objectMapper");
|
||||
|
||||
assertThat(objectMapper).isSameAs(mapper0);
|
||||
assertThat(objectMapper).isSameAs(mapper1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user