{"id":3957,"date":"2025-12-24T10:00:00","date_gmt":"2025-12-24T15:00:00","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=3957"},"modified":"2025-12-18T13:05:24","modified_gmt":"2025-12-18T18:05:24","slug":"mastering-spring-authorization-server-architectural-guide","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/spring-admin\/mastering-spring-authorization-server-architectural-guide\/","title":{"rendered":"Mastering Spring Authorization Server: Architectural Guide"},"content":{"rendered":"\n<p>As a Software Architect, transitioning from the legacy <code>spring-security-oauth2<\/code> to the modern <strong>Spring Authorization Server (SAS)<\/strong> is a critical shift. This guide provides a deep dive into building a robust identity platform integrated with <strong>Spring Cloud Gateway<\/strong> and <strong>Social Logins<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Core Architecture: How it Works<\/h2>\n\n\n\n<p>Spring Authorization Server is the official successor to the legacy OAuth stack. It is built as a standalone library (not a separate product like Keycloak) that you embed in a Spring Boot application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The OAuth 2.1 \/ OIDC 1.0 Flow<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Client Authentication<\/strong>: The client (e.g., Spring Cloud Gateway) redirects the user to the SAS <code>\/oauth2\/authorize<\/code> endpoint.<\/li>\n\n\n\n<li><strong>User Authentication<\/strong>: SAS authenticates the user (via Form Login or Federated Social Login).<\/li>\n\n\n\n<li><strong>Consent<\/strong>: The user grants permission to the client.<\/li>\n\n\n\n<li><strong>Token Issuance<\/strong>: SAS issues a <strong>JWT<\/strong> (Access Token) and an optional <strong>Refresh Token<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">2. Setting Up the Authorization Server (Gradle)<\/h2>\n\n\n\n<p>In your <code>build.gradle<\/code>, include the specialized starter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dependencies {\n    implementation 'org.springframework.boot:spring-boot-starter-oauth2-authorization-server'\n    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' \/\/ For Social Login\n    implementation 'org.springframework.boot:spring-boot-starter-web'\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The Configuration Bean<\/h3>\n\n\n\n<p>SAS requires several beans to define its behavior. The most important is the <code>RegisteredClientRepository<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\npublic class AuthorizationServerConfig {\n\n    @Bean\n    @Order(1)\n    public SecurityFilterChain authServerSecurityFilterChain(HttpSecurity http) throws Exception {\n        OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);\n        http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)\n            .oidc(Customizer.withDefaults());\t\/\/ Enable OpenID Connect 1.0\n        \n        http.exceptionHandling((exceptions) -&gt; exceptions\n            .defaultAuthenticationEntryPointFor(\n                new LoginUrlAuthenticationEntryPoint(\"\/login\"),\n                new MediaTypeRequestMatcher(MediaType.TEXT_HTML)\n            )\n        );\n        return http.build();\n    }\n\n    @Bean\n    public RegisteredClientRepository registeredClientRepository() {\n        RegisteredClient gatewayClient = RegisteredClient.withId(UUID.randomUUID().toString())\n                .clientId(\"gateway-client\")\n                .clientSecret(\"{noop}secret\") \n                .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)\n                .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)\n                .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)\n                .redirectUri(\"&#91;http:\/\/127.0.0.1:8080\/login\/oauth2\/code\/gateway](http:\/\/127.0.0.1:8080\/login\/oauth2\/code\/gateway)\")\n                .scope(OidcScopes.OPENID)\n                .scope(OidcScopes.PROFILE)\n                .scope(\"resource.read\")\n                .build();\n\n        return new InMemoryRegisteredClientRepository(gatewayClient);\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. Role Integration &amp; JWT Customization<\/h2>\n\n\n\n<p>In an OAuth2 ecosystem, roles are typically passed as &#8220;claims&#8221; inside the JWT. By default, SAS doesn&#8217;t include user roles in the access token. You must customize the <code>OAuth2TokenCustomizer<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Customizing the JWT on the Auth Server<\/h3>\n\n\n\n<p>This logic runs on the <strong>Authorization Server<\/strong> to fetch roles from your <code>UserDetailsService<\/code> and inject them into the token.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Bean\npublic OAuth2TokenCustomizer&lt;JwtEncodingContext&gt; tokenCustomizer() {\n    return (context) -&gt; {\n        if (OAuth2TokenType.ACCESS_TOKEN.equals(context.getTokenType())) {\n            Authentication principal = context.getPrincipal();\n            Set&lt;String&gt; authorities = principal.getAuthorities().stream()\n                    .map(GrantedAuthority::getAuthority)\n                    .collect(Collectors.toSet());\n            \n            \/\/ Add custom \"roles\" claim to the JWT\n            context.getClaims().claim(\"roles\", authorities);\n        }\n    };\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Mapping Roles on the Resource Server (Microservices)<\/h3>\n\n\n\n<p>Microservices need to know that the <code>roles<\/code> claim in the JWT should be treated as Spring Security authorities (prefixed with <code>ROLE_<\/code>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\n@EnableMethodSecurity \/\/ Enables @PreAuthorize\npublic class ResourceServerConfig {\n\n    @Bean\n    public JwtAuthenticationConverter jwtAuthenticationConverter() {\n        JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();\n        grantedAuthoritiesConverter.setAuthorityPrefix(\"ROLE_\"); \/\/ Convert 'ADMIN' to 'ROLE_ADMIN'\n        grantedAuthoritiesConverter.setAuthoritiesClaimName(\"roles\"); \/\/ Look for 'roles' claim\n\n        JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();\n        jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter);\n        return jwtAuthenticationConverter;\n    }\n\n    @Bean\n    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {\n        http\n            .authorizeHttpRequests(auth -&gt; auth.anyRequest().authenticated())\n            .oauth2ResourceServer(oauth2 -&gt; oauth2\n                .jwt(jwt -&gt; jwt.jwtAuthenticationConverter(jwtAuthenticationConverter()))\n            );\n        return http.build();\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. Social Login &amp; Federated Identity<\/h2>\n\n\n\n<p>To allow users to login via Google or GitHub, SAS acts as an <strong>OAuth2 Client<\/strong> to those providers while remaining the <strong>Authorization Server<\/strong> for your internal microservices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configuration (<code>application.yml<\/code>)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>spring:\n  security:\n    oauth2:\n      client:\n        registration:\n          google:\n            client-id: ${GOOGLE_CLIENT_ID}\n            client-secret: ${GOOGLE_CLIENT_SECRET}\n            scope: openid, profile, email\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Enabling Federated Login<\/h3>\n\n\n\n<p>In your &#8220;Default&#8221; Security Filter Chain, swap <code>formLogin()<\/code> for <code>oauth2Login()<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Bean\n@Order(2)\npublic SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {\n    http\n        .authorizeHttpRequests((authorize) -&gt; authorize\n            .anyRequest().authenticated()\n        )\n        .oauth2Login(Customizer.withDefaults()); \n    \n    return http.build();\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5. Integration with Spring Cloud Gateway<\/h2>\n\n\n\n<p>The <strong>Gateway<\/strong> should act as the <strong>OAuth2 Client<\/strong>. It handles the login flow and then relays the JWT to downstream microservices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Gateway Dependencies (<code>build.gradle<\/code>)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dependencies {\n    implementation 'org.springframework.cloud:spring-cloud-starter-gateway'\n    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Token Relay Pattern<\/h3>\n\n\n\n<p>The <code>TokenRelay<\/code> filter automatically extracts the Access Token from the session and adds it as a <code>Authorization: Bearer &lt;token&gt;<\/code> header to downstream requests.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>spring:\n  cloud:\n    gateway:\n      routes:\n        - id: user-service\n          uri: lb:\/\/user-service\n          predicates:\n            - Path=\/api\/users\/**\n          filters:\n            - TokenRelay= \n  \n  security:\n    oauth2:\n      client:\n        provider:\n          spring-auth-server:\n            issuer-uri: http:\/\/auth-server:9000\n        registration:\n          gateway:\n            provider: spring-auth-server\n            client-id: gateway-client\n            client-secret: secret\n            authorization-grant-type: authorization_code\n            scope: openid, profile, resource.read\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6. Securing Spring Boot Admin Server<\/h2>\n\n\n\n<p>Securing the Admin Server involves protecting its UI and its communication with client instances.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Admin Server as OAuth2 Client (<code>build.gradle<\/code>)<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dependencies {\n    implementation 'de.codecentric:spring-boot-admin-server'\n    implementation 'de.codecentric:spring-boot-admin-server-ui'\n    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Security Filter Chain<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\npublic class AdminSecurityConfig {\n    private final AdminServerProperties adminServer;\n\n    public AdminSecurityConfig(AdminServerProperties adminServer) {\n        this.adminServer = adminServer;\n    }\n\n    @Bean\n    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {\n        SavedRequestAwareAuthenticationSuccessHandler successHandler = \n            new SavedRequestAwareAuthenticationSuccessHandler();\n        successHandler.setTargetUrlParameter(\"redirectTo\");\n        successHandler.setDefaultTargetUrl(this.adminServer.getContextPath() + \"\/\");\n\n        http.authorizeHttpRequests(authorize -&gt; authorize\n                .requestMatchers(this.adminServer.getContextPath() + \"\/assets\/**\").permitAll()\n                .requestMatchers(this.adminServer.getContextPath() + \"\/login\").permitAll()\n                .anyRequest().authenticated()\n            )\n            .oauth2Login(oauth2 -&gt; oauth2\n                .loginPage(this.adminServer.getContextPath() + \"\/login\")\n                .successHandler(successHandler)\n            )\n            .csrf(csrf -&gt; csrf.disable());\n        \n        return http.build();\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">7. Securing Downstream Microservices (Resource Servers)<\/h2>\n\n\n\n<p>Microservices behind the gateway only need to trust the <strong>Spring Authorization Server<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Security Configuration with Method Security<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>@RestController\n@RequestMapping(\"\/api\/orders\")\npublic class OrderController {\n\n    @GetMapping(\"\/{id}\")\n    @PreAuthorize(\"hasRole('USER')\") \/\/ Role-based security at the method level\n    public Order getOrder(@PathVariable String id) {\n        return orderService.findById(id);\n    }\n\n    @DeleteMapping(\"\/{id}\")\n    @PreAuthorize(\"hasRole('ADMIN')\")\n    public void deleteOrder(@PathVariable String id) {\n        orderService.delete(id);\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Summary for Architects<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Component<\/strong><\/td><td><strong>Role<\/strong><\/td><td><strong>Role Management<\/strong><\/td><\/tr><tr><td><strong>Auth Server<\/strong><\/td><td>IDP<\/td><td>Fetches roles from DB and embeds them in JWT via <code>OAuth2TokenCustomizer<\/code>.<\/td><\/tr><tr><td><strong>Gateway<\/strong><\/td><td>Client<\/td><td>Agnostic of internal roles; simply relays the token.<\/td><\/tr><tr><td><strong>Resource Server<\/strong><\/td><td>API<\/td><td>Converts JWT <code>roles<\/code> claim to <code>GrantedAuthorities<\/code> and enforces via <code>@PreAuthorize<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>By centralizing role mapping in the <code>OAuth2TokenCustomizer<\/code>, you ensure that all microservices receive a consistent security context regardless of the authentication source (Social vs. Form Login).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a Software Architect, transitioning from the legacy spring-security-oauth2 to the modern Spring Authorization Server (SAS) is a critical shift. This guide provides a deep dive into building a robust identity platform integrated with Spring Cloud Gateway and Social Logins. 1. Core Architecture: How it Works Spring Authorization Server is the official successor to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3958,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[489],"tags":[69,477,319,490],"series":[],"class_list":["post-3957","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-admin","tag-java-2","tag-oauth","tag-spring","tag-spring-admin"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/12\/Gemini_Generated_Image_dj5ssndj5ssndj5s.avif","jetpack-related-posts":[{"id":3922,"url":"https:\/\/www.mymiller.name\/wordpress\/spng_security\/beyond-rbac-spring-security-6-oauth-2-1-and-the-zero-trust-evolution\/","url_meta":{"origin":3957,"position":0},"title":"Beyond RBAC: Spring Security 6, OAuth 2.1, and the Zero-Trust Evolution","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"The journey to Zero Trust (ZT) is an ongoing architectural evolution, not a single deployment. While the foundational principles\u2014never trust, always verify\u2014are clear, implementing them in a distributed microservice environment requires rigorous adherence to modern standards. For Spring architects and developers, Spring Security 6 and the Spring Authorization Server provide\u2026","rel":"","context":"In &quot;Spring Security&quot;","block_context":{"text":"Spring Security","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spng_security\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/coding-1841550_1280.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/coding-1841550_1280.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/coding-1841550_1280.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/coding-1841550_1280.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/11\/coding-1841550_1280.avif 3x"},"classes":[]},{"id":3438,"url":"https:\/\/www.mymiller.name\/wordpress\/spring\/architecting-with-spring-and-spring-cloud\/","url_meta":{"origin":3957,"position":1},"title":"Architecting with Spring and Spring Cloud","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Building a Multi-Service Architecture with Spring 3.1.x and Spring Cloud: Unlocking the Power of Microservices In the ever-evolving landscape of software development, microservices have emerged as a powerful architectural paradigm, enabling organizations to build scalable, resilient, and agile applications. Spring, a widely adopted Java framework, provides a comprehensive suite of\u2026","rel":"","context":"In &quot;Spring&quot;","block_context":{"text":"Spring","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/field-5236879_640.jpg?fit=640%2C360&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/field-5236879_640.jpg?fit=640%2C360&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/field-5236879_640.jpg?fit=640%2C360&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3828,"url":"https:\/\/www.mymiller.name\/wordpress\/spring-gateway\/load-balancing-your-microservices-configuring-spring-cloud-gateway-with-spring-discovery-server\/","url_meta":{"origin":3957,"position":2},"title":"Load Balancing Your Microservices: Configuring Spring Cloud Gateway with Spring Discovery Server","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"In a microservices architecture, ensuring high availability and distributing traffic evenly across multiple instances of a service is paramount. Spring Cloud Gateway, when integrated with a Spring Discovery Server (like Netflix Eureka, Consul, or Spring Cloud Service Registry), provides a powerful and straightforward way to achieve client-side load balancing without\u2026","rel":"","context":"In &quot;Spring Gateway&quot;","block_context":{"text":"Spring Gateway","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring-gateway\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/meditation-3814069_1280.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/meditation-3814069_1280.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/meditation-3814069_1280.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/meditation-3814069_1280.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/meditation-3814069_1280.avif 3x"},"classes":[]},{"id":3632,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_sockets\/real-time-communication-with-spring-boot-websockets-a-comprehensive-guide\/","url_meta":{"origin":3957,"position":3},"title":"Real-Time Communication with Spring Boot WebSockets: A Comprehensive Guide","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"In the world of modern web applications, real-time communication has become a necessity. Whether it\u2019s live chat, collaborative editing, or real-time data updates, WebSockets have emerged as the go-to technology to enable seamless, bidirectional communication between the browser and server. In this article, we\u2019ll dive into how to harness the\u2026","rel":"","context":"In &quot;Spring Sockets&quot;","block_context":{"text":"Spring Sockets","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_sockets\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/cpu-4393380_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/cpu-4393380_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/cpu-4393380_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/cpu-4393380_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/cpu-4393380_1280-jpg.avif 3x"},"classes":[]},{"id":3641,"url":"https:\/\/www.mymiller.name\/wordpress\/spng_security\/integrating-java-spring-with-keycloak-a-comprehensive-guide\/","url_meta":{"origin":3957,"position":4},"title":"Integrating Java Spring with Keycloak: A Comprehensive Guide","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Java Spring, a popular framework for building enterprise-level applications, can seamlessly integrate with Keycloak, a robust open-source Identity and Access Management (IAM) solution. This combination offers a powerful way to implement secure authentication, authorization, and user management features in your Spring-based applications. Let\u2019s explore how to achieve this integration along\u2026","rel":"","context":"In &quot;Spring Security&quot;","block_context":{"text":"Spring Security","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spng_security\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/ghost-7571881_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/ghost-7571881_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/ghost-7571881_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/ghost-7571881_1280-jpg.avif 2x"},"classes":[]},{"id":3542,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_open_feign\/simplified-rest-clients-with-openfeign-in-java\/","url_meta":{"origin":3957,"position":5},"title":"Simplified REST Clients with OpenFeign in Java","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"OpenFeign, a declarative HTTP client, simplifies REST API interactions in Java. Let\u2019s see how: Dependency: Add OpenFeign to your project (Maven example): <dependency> <groupId>org.springframework.cloud<\/groupId> <artifactId>spring-cloud-starter-openfeign<\/artifactId> <\/dependency> Interface: Define an interface mirroring your REST endpoints: @FeignClient(name = \"myService\", url = \"${myService.url}\") public interface MyServiceClient { @GetMapping(\"\/users\/{id}\") User getUserById(@PathVariable(\"id\") Long id, @RequestHeader(\"Authorization\")\u2026","rel":"","context":"In &quot;Spring Open Feign&quot;","block_context":{"text":"Spring Open Feign","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_open_feign\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/technology-7173626_1280.jpg?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/technology-7173626_1280.jpg?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/technology-7173626_1280.jpg?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/technology-7173626_1280.jpg?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/technology-7173626_1280.jpg?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=3957"}],"version-history":[{"count":1,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3957\/revisions"}],"predecessor-version":[{"id":3959,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3957\/revisions\/3959"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/3958"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=3957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=3957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=3957"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=3957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}