{"id":19656310,"url":"https://github.com/daggerok/spring-boot-http2","last_synced_at":"2025-04-28T18:32:51.567Z","repository":{"id":151042050,"uuid":"138787611","full_name":"daggerok/spring-boot-http2","owner":"daggerok","description":"Enable HTTP 2.0 in spring-boot 2 non netty (non webflux) apps running on java 9+","archived":false,"fork":false,"pushed_at":"2018-06-28T22:53:42.000Z","size":190,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T10:23:06.225Z","etag":null,"topics":["http2","spring-boot","spring-boot-2","spring-boot-https"],"latest_commit_sha":null,"homepage":"https://daggerok.github.io/spring-boot-http2","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daggerok.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-26T20:08:23.000Z","updated_at":"2021-08-19T19:16:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"d617e691-f099-46e8-8352-4bbc11c25860","html_url":"https://github.com/daggerok/spring-boot-http2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fspring-boot-http2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fspring-boot-http2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fspring-boot-http2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fspring-boot-http2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daggerok","download_url":"https://codeload.github.com/daggerok/spring-boot-http2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251366128,"owners_count":21578079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http2","spring-boot","spring-boot-2","spring-boot-https"],"created_at":"2024-11-11T15:27:24.064Z","updated_at":"2025-04-28T18:32:51.555Z","avatar_url":"https://github.com/daggerok.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= spring-boot-http2 image:https://travis-ci.org/daggerok/spring-boot-http2.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/daggerok/spring-boot-http2\"]\n\n////\nimage:https://gitlab.com/daggerok/spring-boot-http2/badges/master/build.svg[\"Build Status\", link=\"https://gitlab.com/daggerok/spring-boot-http2/-/jobs\"]\nimage:https://img.shields.io/bitbucket/pipelines/daggerok/spring-boot-http2.svg[\"Build Status\", link=\"https://bitbucket.com/daggerok/spring-boot-http2\"]\n////\n\n//tag::content[]\n\n== HTTP 2.0 with spring-boot 2 on java 9+\n\nread link:https://daggerok.github.io/spring-boot-http2[project reference documentation]\n\n=== TL;DR\n\nExample how to enable HTTP 2.0 in spring-boot 2 non netty (non webflux) apps running on java 9+\n\n=== certificate\n\n.generate self signed sertificates\n[source,bash]\n----\n# server side:\nkeytool -genkeypair -alias my-keystore -keyalg RSA -keystore src/main/resources/my-keystore.jks \\\n        -dname \"CN=boot-jwt, L=Odessa, S=Odessa, C=UA\" \\\n        -keypass my-keystore-password -storepass my-keystore-password\n\nkeytool -list -rfc --keystore src/main/resources/my-keystore.jks | openssl x509 -inform pem -pubkey \u003e src/main/resources/my-keystore.pem\nEnter keystore password:  my-keystore-password\n\n# client side:\nopenssl x509 -pubkey -noout -in src/main/resources/my-keystore.pem  \u003e src/main/resources/my-keystore-pubkey.pem\n----\n\n////\n.output\n[source,bash]\n----\nWarning:\nThe JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using \"keytool -importkeystore -srckeystore src/main/resources/my-keystore.jks -destkeystore src/main/resources/my-keystore.jks -deststoretype pkcs12\".\n----\n\n.so let's follow recommendations\n[source,bash]\n----\nkeytool -importkeystore -srckeystore src/main/resources/my-keystore.jks -destkeystore src/main/resources/my-keystore.jks -deststoretype pkcs12\n----\n\n.output\n[source,bash]\n----\nEnter source keystore password: # enter here my-keystore-password\nEntry for alias my-keystore successfully imported.\nImport command completed:  1 entries successfully imported, 0 entries failed or cancelled\n\nWarning:\nMigrated \"src/main/resources/my-keystore.jks\" to Non JKS/JCEKS. The JKS keystore is backed up as \"src/main/resources/my-keystore.jks.old\".\n----\n////\n\nso now we have it:\n- server will consume file: `src/main/resources/my-keystore.jks`\n- clients needs file: `src/main/resources/my-keystore-pubkey.pem`\n\n=== setup spring-boot app\n\n.output\n[source,bash]\n----\ninclude::./src/main/resources/application.yaml[tags=content]\n----\n\n=== install java 9 or 10 or use jenv to switch java version\n\n.http 2.0 is working on java 9+, so lets switch on it:\n[source,bash]\n----\n# install jenv to easily switch between java verions:\nbrew install jenv\n\n# install java 9\n\n# all installed JVMs on my mac:\nls -l /Library/Java/JavaVirtualMachines/\ntotal 0\ndrwxr-xr-x  3 root  wheel  96 Jul 15  2015 1.6.0.jdk\ndrwxr-xr-x  3 root  wheel  96 Apr 20 22:42 jdk-10.0.1.jdk\ndrwxr-xr-x  2 root  wheel  64 Apr 20 22:42 jdk-10.jdk\ndrwxr-xr-x  3 root  wheel  96 Nov  8  2017 jdk-9.0.1.jdk\ndrwxr-xr-x  2 root  wheel  64 Mar 24 04:08 jdk-9.0.4.jdk\ndrwxr-xr-x  3 root  wheel  96 Mar 28 00:34 jdk1.7.0_80.jdk\ndrwxr-xr-x  3 root  wheel  96 Nov 11  2017 jdk1.8.0_152.jdk\ndrwxr-xr-x  3 root  wheel  96 Mar 19 01:59 jdk1.8.0_161.jdk\ndrwxr-xr-x  2 root  wheel  64 Apr 20 22:44 jdk1.8.0_162.jdk\ndrwxr-xr-x  3 root  wheel  96 Apr 20 22:44 jdk1.8.0_172.jdk\n\n# add JVM 9 to my jenv:\njenv add /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/\noracle64-9.0.1 added\n9.0 added\n\n# check current JVM:\njava -version\njava version \"1.8.0_152\"\nJava(TM) SE Runtime Environment (build 1.8.0_152-b16)\nJava HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)\n\n# check avalible JVMs to switch to:\njenv versions\n  system\n  1.6\n  1.6.0.65\n  1.7\n  1.7.0.80\n  1.8\n  1.8.0.152\n  10.0\n  10.0.1\n  9.0\n  9.0.1\n  oracle64-1.6.0.65\n  oracle64-1.7.0.80\n* oracle64-1.8.0.152 (set by /private/tmp/spring-boot-http2/.java-version)\n  oracle64-10.0.1\n  oracle64-9.0.1\n\n# switch local jvm to JDK 9:\njenv local 9.0.1\n\n# versify:\njava -version\njava version \"9.0.1\"\nJava(TM) SE Runtime Environment (build 9.0.1+11)\nJava HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)\n----\n\n.now build and run project using gradle:\n[source,bash]\n----\n./gradlew clean build\nbash ./build/libs/*.jar\n----\n\n.switch to java 10 and build using maven:\n[source,bash]\n----\njenv local 10.0\n\njava -version\njava version \"10.0.1\" 2018-04-17\nJava(TM) SE Runtime Environment 18.3 (build 10.0.1+10)\nJava HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)\n\n./mvnw\n\nbash target/*.jar\n----\n\nLastly open browser https://127.0.0.1:8443/ and developer tool and refresh page.\nGo to network tab and enable protocol column.\nRefresh page and if you can see: `h2` protocol, then everything is correct\n\ngenerated by link:https://github.com/daggerok/generator-jvm/[generator-jvm] yeoman generator (java-spring-boot)\n//end::content[]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaggerok%2Fspring-boot-http2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaggerok%2Fspring-boot-http2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaggerok%2Fspring-boot-http2/lists"}