Create embedded database on Neo4j 4.0.2

Im doing a migration from Neo4j 3 to 4, and Im stuck at the following problem:

Before, I had this line to create an embedded database:
service = new GraphDatabaseFactory().newEmbeddedDatabase(dir);

Now, I can't find a similar substitute for it.
What is the correct way to create a embedded database on Neo4j 4.0.2?

It is described here:

DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(databaseDirectory).build();
GraphDatabaseService graphDb = managementService.database(DEFAULT_DATABASE_NAME);

This should work.

Personally I'm struggling with the way to activate the http-console, because it should work with the following snippet (but it does not work)

DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(databaseDirectory)
.setConfig(HttpConnector.enabled, true)