Skip to content

Commit

Permalink
[#98] Add generics to the KeycloakContainer class
Browse files Browse the repository at this point in the history
Signed-off-by: Nils Christian Ehmke <nils-christian.ehmke@bmiag.de>
  • Loading branch information
nils-christian authored and dasniko committed Feb 14, 2023
1 parent fce9751 commit 9b721be
Show file tree
Hide file tree
Showing 3 changed files with 451 additions and 397 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,29 @@ KeycloakContainer keycloak = new KeycloakContainer()

You have to provide a list of resolvable `File`s.

### Extending KeycloakContainer

In case you need a custom implementation of the default `KeycloakContainer`, you should inherit from `ExtendableKeycloakContainer`. This allows to set the generics and use your custom implementation without the need for type casts.

```java
public class MyCustomKeycloakContainer extends ExtendableKeycloakContainer<MyCustomKeycloakContainer> {

public MyCustomKeycloakContainer() {
super();
}

public MyCustomKeycloakContainer(String dockerImageName) {
super(dockerImageName);
}

}

...

MyCustomKeycloakContainer keycloakContainer = new MyCustomKeycloakContainer()
.withAdminPassword("password");
```

#### TIPP

If you want/need to use dependencies from e.g. Maven (or Gradle), you can use [ShrinkWrap Resolvers](https://github.com/shrinkwrap/resolver).
Expand Down
Loading

0 comments on commit 9b721be

Please sign in to comment.