title: Spring boot and Keycloak
body: <p>I'm using this example: <strong><a href="https://github.com/foo4u/keycloak-spring-demo" rel="nofollow noreferrer">https://github.com/foo4u/keycloak-spring-demo</a></strong></p>
  
  <p>I have keycloak.json file in my WEB-INF folder, but when I run my application, I get this exception:</p>
  
  <pre><code>java.lang.RuntimeException: Must set 'realm' in config
  </code></pre>
  
  <p>Full stack of this exception:</p>
  
  <pre><code>java.lang.RuntimeException: Must set 'realm' in config
      at org.keycloak.adapters.KeycloakDeploymentBuilder.internalBuild(KeycloakDeploymentBuilder.java:53) ~[keycloak-adapter-core-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.KeycloakDeploymentBuilder.build(KeycloakDeploymentBuilder.java:152) ~[keycloak-adapter-core-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver.resolve(KeycloakSpringBootConfigResolver.java:37) ~[keycloak-spring-boot-adapter-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.AdapterDeploymentContext.resolveDeployment(AdapterDeploymentContext.java:88) ~[keycloak-adapter-core-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.PreAuthActionsHandler.preflightCors(PreAuthActionsHandler.java:107) ~[keycloak-adapter-core-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.PreAuthActionsHandler.handleRequest(PreAuthActionsHandler.java:79) ~[keycloak-adapter-core-2.4.0.Final.jar:2.4.0.Final]
      at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.invoke(AbstractKeycloakAuthenticatorValve.java:183) ~[keycloak-tomcat-core-adapter-2.4.0.Final.jar:2.4.0.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar:8.5.5]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
  </code></pre>
  
  <p>This code is just an example of integration between Spring boot and Keycloak.</p>
  
  <p>Can you please tell me what am I doing wrong?</p>
  
  <p>Thanks for your answer and time. </p>