<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Spring on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/spring/</link>
    <description>Recent content in Spring on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo -- 0.147.8</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #213243b1d6e8932079e09227d3f3ed0c806cd0c9</copyright>
    <lastBuildDate>Tue, 16 Aug 2022 00:00:00 +0200</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/spring/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Forwardings Requests to static content in Spring Boot Webflux</title>
      <link>https://www.hascode.com/forwardings-requests-to-static-content-in-spring-boot-webflux/</link>
      <pubDate>Tue, 16 Aug 2022 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/forwardings-requests-to-static-content-in-spring-boot-webflux/</guid>
      <description>&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following &lt;code&gt;WebFilter&lt;/code&gt; redirects incoming requests for &lt;code&gt;/&lt;/code&gt; to a static HTML file, &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;ToIndexPageRedirection.java&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;package com.hascode.tutorial;

import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;

@Component
public class ToIndexPageRedirection implements WebFilter {
    @Override
    public Mono&amp;lt;Void&amp;gt; filter(ServerWebExchange exchange, WebFilterChain chain) {
        if (exchange.getRequest().getURI().getPath().equals(&amp;#34;/&amp;#34;)) {
            return chain.filter(
                exchange.mutate().request(
                    exchange.getRequest().mutate().path(&amp;#34;/index.html&amp;#34;).build()
                ).build()
            );
        }

        return chain.filter(exchange);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;&lt;strong&gt;Ressources:&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/server/WebFilter.html&#34;&gt;JavaDocs WebFilter&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Spring Boot Kafka Increase Message Size Limit</title>
      <link>https://www.hascode.com/spring-boot-kafka-increase-message-size-limit/</link>
      <pubDate>Thu, 09 Jun 2022 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/spring-boot-kafka-increase-message-size-limit/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Let’s say we would like to increase the limit t 10MB …​&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_broker_configuration&#34;&gt;Broker Configuration&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Apply the new limit either by modifying the &lt;code&gt;server.properties&lt;/code&gt; like this…​&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-properties&#34; data-lang=&#34;properties&#34;&gt;max.message.bytes=10485760&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;olist lowerroman&#34;&gt;
&lt;ol class=&#34;lowerroman&#34; type=&#34;i&#34;&gt;
&lt;li&gt;
&lt;p&gt;or apply it to a specific topic using&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;kafka-configs.sh --bootstrap-server localhost:9092 \
    --entity-type topics  \
    --entity-name thetopic \
    --alter \
    --add-config max.message.bytes=10485760&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_producer_configuration_for_spring_boot&#34;&gt;Producer Configuration for Spring Boot&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We simply need to add the following line to our &lt;code&gt;application.properties&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-properties&#34; data-lang=&#34;properties&#34;&gt;spring.kafka.producer.properties.max.request.size=spring.kafka.producer.properties.max.request.size&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following proof-of-concept demonstrates that without the property, sending a large message fails, with the property it succeeds:&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Embedded Kafka for Spring Boot Testing without using Docker</title>
      <link>https://www.hascode.com/embedded-kafka-for-spring-boot-testing-without-using-docker/</link>
      <pubDate>Wed, 25 May 2022 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/embedded-kafka-for-spring-boot-testing-without-using-docker/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Sometimes it is nice to set up an embedded Kafka broker for testing without the need to have Docker installed (e.g. for using testcontainers-lib).&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following snippet shows, how to set up an embedded Kafka instance for testing for a Spring Boot project.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_setup&#34;&gt;Setup&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Using Maven, this is our Spring Boot project with dependencies needed:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;title&#34;&gt;pom.xml&lt;/div&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;
&amp;lt;project xmlns=&amp;#34;http://maven.apache.org/POM/4.0.0&amp;#34;
         xmlns:xsi=&amp;#34;http://www.w3.org/2001/XMLSchema-instance&amp;#34;
         xsi:schemaLocation=&amp;#34;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&amp;#34;&amp;gt;
    &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
    &amp;lt;parent&amp;gt;
        &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;spring-boot-starter-parent&amp;lt;/artifactId&amp;gt;&lt;i class=&#34;conum&#34; data-value=&#34;1&#34;&gt;&lt;/i&gt;&lt;b&gt;(1)&lt;/b&gt;
        &amp;lt;version&amp;gt;2.6.4&amp;lt;/version&amp;gt;
        &amp;lt;relativePath/&amp;gt; &amp;lt;!-- lookup parent from repository --&amp;gt;
    &amp;lt;/parent&amp;gt;

    &amp;lt;groupId&amp;gt;com.hascode.tutorial&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;kafka-testing&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0.0-SNAPSHOT&amp;lt;/version&amp;gt;

    &amp;lt;properties&amp;gt;
        &amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt;
        &amp;lt;project.reporting.outputEncoding&amp;gt;UTF-8&amp;lt;/project.reporting.outputEncoding&amp;gt;
        &amp;lt;java.version&amp;gt;17&amp;lt;/java.version&amp;gt;
        &amp;lt;maven.compiler.source&amp;gt;${java.version}&amp;lt;/maven.compiler.source&amp;gt;
        &amp;lt;maven.compiler.target&amp;gt;${java.version}&amp;lt;/maven.compiler.target&amp;gt;
        &amp;lt;kafka.version&amp;gt;3.1.0&amp;lt;/kafka.version&amp;gt;&lt;i class=&#34;conum&#34; data-value=&#34;2&#34;&gt;&lt;/i&gt;&lt;b&gt;(2)&lt;/b&gt;
    &amp;lt;/properties&amp;gt;

    &amp;lt;dependencies&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-boot-starter&amp;lt;/artifactId&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.kafka&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-kafka&amp;lt;/artifactId&amp;gt;&lt;i class=&#34;conum&#34; data-value=&#34;3&#34;&gt;&lt;/i&gt;&lt;b&gt;(3)&lt;/b&gt;
        &amp;lt;/dependency&amp;gt;

        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-boot-starter-test&amp;lt;/artifactId&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.kafka&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-kafka-test&amp;lt;/artifactId&amp;gt;&lt;i class=&#34;conum&#34; data-value=&#34;4&#34;&gt;&lt;/i&gt;&lt;b&gt;(4)&lt;/b&gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;

        &amp;lt;dependency&amp;gt;&lt;i class=&#34;conum&#34; data-value=&#34;5&#34;&gt;&lt;/i&gt;&lt;b&gt;(5)&lt;/b&gt;
            &amp;lt;groupId&amp;gt;org.junit.jupiter&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;junit-jupiter-api&amp;lt;/artifactId&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.junit.jupiter&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;junit-jupiter-engine&amp;lt;/artifactId&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.junit.platform&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;junit-platform-launcher&amp;lt;/artifactId&amp;gt;
            &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
        [..]
&amp;lt;/project&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Configuring Spring Boot WebserviceTemplate to sign WSS SOAP Requests</title>
      <link>https://www.hascode.com/configuring-spring-boot-webservicetemplate-to-sign-wss-soap-requests/</link>
      <pubDate>Wed, 30 Mar 2022 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/configuring-spring-boot-webservicetemplate-to-sign-wss-soap-requests/</guid>
      <description>&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Sometimes when accessing SOAP APIs, our SOAP client needs to sign the request.
How this can be achieved using Spring Boot’s WebserviceTemplate within a few steps is the scope of this short article.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;admonitionblock tip&#34;&gt;
&lt;table&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-tip&#34; title=&#34;Tip&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This snippet only deals with the client side not with the security configuration on the server side.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Also it assumes, that you have already set up your keystore/truststore and that you’re loading these with your Spring Boot application’s startup without errors.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Logback and Spring Boot - Change Log Level to custom format</title>
      <link>https://www.hascode.com/logback-and-spring-boot-change-log-level-to-custom-format/</link>
      <pubDate>Thu, 19 Aug 2021 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/logback-and-spring-boot-change-log-level-to-custom-format/</guid>
      <description>&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_create_a_custom_converter&#34;&gt;Create a custom converter&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;This class converts the well known log levels to a custom format&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;title&#34;&gt;CustomLogLevelConverter.java&lt;/div&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;package com.hascode;

public class CustomLogLevelConverter extends ClassicConverter {
    @Override
    public String convert(ILoggingEvent event) {
        switch (event.getLevel().toInt()) {
            case Level.ERROR_INT:
                return &amp;#34;ERROR!!!&amp;#34;;
            case Level.WARN_INT:
                return &amp;#34;WARN!!&amp;#34;;
            case Level.INFO_INT:
                return &amp;#34;INFO!&amp;#34;;
            case Level.TRACE_INT:
                return &amp;#34;DEBUG&amp;#34;;
            default:
                return event.getLevel().toString();
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_register_the_converter&#34;&gt;Register the converter&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;The following Logback config includes some defaults and registers our custom converter.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Package a Spring Boot App as RPM</title>
      <link>https://www.hascode.com/package-a-spring-boot-app-as-rpm/</link>
      <pubDate>Fri, 14 May 2021 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/package-a-spring-boot-app-as-rpm/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;sidebarblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;div class=&#34;title&#34;&gt;Goals&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;Package a Spring Boot Service as RPM Package&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure systemd integration&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add install/uninstall hooks to create users, directories etc.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_maven_setup&#34;&gt;Maven Setup&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;
&amp;lt;project xmlns=&amp;#34;http://maven.apache.org/POM/4.0.0&amp;#34;
  xmlns:xsi=&amp;#34;http://www.w3.org/2001/XMLSchema-instance&amp;#34;
  xsi:schemaLocation=&amp;#34;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&amp;#34;&amp;gt;
  &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
  &amp;lt;parent&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-parent&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.4.2&amp;lt;/version&amp;gt;
    &amp;lt;relativePath/&amp;gt;
  &amp;lt;/parent&amp;gt;
  &amp;lt;groupId&amp;gt;com.hascode&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;sample-app&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;1.0.0-SNAPSHOT&amp;lt;/version&amp;gt;
  &amp;lt;name&amp;gt;sample-app&amp;lt;/name&amp;gt;

  &amp;lt;properties&amp;gt;
    &amp;lt;java.version&amp;gt;11&amp;lt;/java.version&amp;gt;
  &amp;lt;/properties&amp;gt;
  &amp;lt;dependencies&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
      &amp;lt;artifactId&amp;gt;spring-boot-starter-web&amp;lt;/artifactId&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
      &amp;lt;artifactId&amp;gt;spring-boot-starter-actuator&amp;lt;/artifactId&amp;gt;
    &amp;lt;/dependency&amp;gt;
  &amp;lt;/dependencies&amp;gt;

  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;1&#34;&gt;&lt;/i&gt;&lt;b&gt;(1)&lt;/b&gt;
        &amp;lt;groupId&amp;gt;de.dentrassi.maven&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;rpm&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;1.5.0&amp;lt;/version&amp;gt;
        &amp;lt;executions&amp;gt;
          &amp;lt;execution&amp;gt;
            &amp;lt;goals&amp;gt;
              &amp;lt;goal&amp;gt;rpm&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
          &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
        &amp;lt;configuration&amp;gt;
          &amp;lt;packageName&amp;gt;sample-app&amp;lt;/packageName&amp;gt;
          &amp;lt;skipSigning&amp;gt;true&amp;lt;/skipSigning&amp;gt;
          &amp;lt;group&amp;gt;Application/Misc&amp;lt;/group&amp;gt;
          &amp;lt;requires&amp;gt;
            &amp;lt;require&amp;gt;java-11-openjdk-headless&amp;lt;/require&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;2&#34;&gt;&lt;/i&gt;&lt;b&gt;(2)&lt;/b&gt;
          &amp;lt;/requires&amp;gt;
          &amp;lt;entries&amp;gt;
            &amp;lt;entry&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;3&#34;&gt;&lt;/i&gt;&lt;b&gt;(3)&lt;/b&gt;
              &amp;lt;name&amp;gt;/opt/sample-app&amp;lt;/name&amp;gt;
              &amp;lt;directory&amp;gt;true&amp;lt;/directory&amp;gt;
              &amp;lt;user&amp;gt;root&amp;lt;/user&amp;gt;
              &amp;lt;group&amp;gt;root&amp;lt;/group&amp;gt;
              &amp;lt;mode&amp;gt;0755&amp;lt;/mode&amp;gt;
            &amp;lt;/entry&amp;gt;
            &amp;lt;entry&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;4&#34;&gt;&lt;/i&gt;&lt;b&gt;(4)&lt;/b&gt;
              &amp;lt;name&amp;gt;/opt/sample-app/log&amp;lt;/name&amp;gt;
              &amp;lt;directory&amp;gt;true&amp;lt;/directory&amp;gt;
              &amp;lt;user&amp;gt;sample-app&amp;lt;/user&amp;gt;
              &amp;lt;group&amp;gt;sample-app&amp;lt;/group&amp;gt;
              &amp;lt;mode&amp;gt;0750&amp;lt;/mode&amp;gt;
            &amp;lt;/entry&amp;gt;
            &amp;lt;entry&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;5&#34;&gt;&lt;/i&gt;&lt;b&gt;(5)&lt;/b&gt;
              &amp;lt;name&amp;gt;/opt/sample-app/sample-app.jar&amp;lt;/name&amp;gt;
              &amp;lt;file&amp;gt;${project.build.directory}/${project.build.finalName}.jar&amp;lt;/file&amp;gt;
              &amp;lt;user&amp;gt;root&amp;lt;/user&amp;gt;
              &amp;lt;group&amp;gt;root&amp;lt;/group&amp;gt;
              &amp;lt;mode&amp;gt;0644&amp;lt;/mode&amp;gt;
            &amp;lt;/entry&amp;gt;
            &amp;lt;entry&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;6&#34;&gt;&lt;/i&gt;&lt;b&gt;(6)&lt;/b&gt;
              &amp;lt;name&amp;gt;/usr/lib/systemd/system/sample-app.service&amp;lt;/name&amp;gt;
              &amp;lt;file&amp;gt;${project.basedir}/src/main/dist/sample-app.service&amp;lt;/file&amp;gt;
              &amp;lt;mode&amp;gt;0644&amp;lt;/mode&amp;gt;
            &amp;lt;/entry&amp;gt;
          &amp;lt;/entries&amp;gt;
          &amp;lt;beforeInstallation&amp;gt; &lt;i class=&#34;conum&#34; data-value=&#34;7&#34;&gt;&lt;/i&gt;&lt;b&gt;(7)&lt;/b&gt;
            &amp;lt;file&amp;gt;${project.basedir}/src/main/dist/preinstall.sh&amp;lt;/file&amp;gt;
          &amp;lt;/beforeInstallation&amp;gt;
          &amp;lt;afterInstallation&amp;gt;
            &amp;lt;file&amp;gt;${project.basedir}/src/main/dist/postinstall.sh&amp;lt;/file&amp;gt;
          &amp;lt;/afterInstallation&amp;gt;
          &amp;lt;beforeRemoval&amp;gt;
            &amp;lt;file&amp;gt;${project.basedir}/src/main/dist/preuninstall.sh&amp;lt;/file&amp;gt;
          &amp;lt;/beforeRemoval&amp;gt;
          &amp;lt;license&amp;gt;All rights reserved&amp;lt;/license&amp;gt;
        &amp;lt;/configuration&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
  &amp;lt;/build&amp;gt;

&amp;lt;/project&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Identity Management, One-Time-Passwords and Two-Factor-Auth with Spring Boot and Keycloak</title>
      <link>https://www.hascode.com/identity-management-one-time-passwords-and-two-factor-auth-with-spring-boot-and-keycloak/</link>
      <pubDate>Sun, 26 Nov 2017 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/identity-management-one-time-passwords-and-two-factor-auth-with-spring-boot-and-keycloak/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Communicating with  identity and access management systems is a common task for many web-applications exposing secured resources.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Keycloak is an open source software that provides not also such authorization services but also offers a lot of features from Single-Sign-On, Identity-Brokering, Social-Login, User-Federation, multiple client-adapters up to the administration console or support for protocols like OpenID, SAML, OAuth2, Kerberos and more.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;I will demonstrate how to integrate a Spring Boot web application with Keycloak and configure an authentication flow that requires a two-factor-authentication with user credentials and also one-time-passwords.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Setting up an OAuth2 Authorization Server and Resource Provider with Spring Boot</title>
      <link>https://www.hascode.com/setting-up-an-oauth2-authorization-server-and-resource-provider-with-spring-boot/</link>
      <pubDate>Sun, 13 Mar 2016 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/setting-up-an-oauth2-authorization-server-and-resource-provider-with-spring-boot/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;OAuth2 is a frequently used standard for authorization and with Spring Boot it is easy to set up authorization and resource server in no time.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following short tutorial I’d like to demonstrate how to set up an OAuth2 authorization server as well as a connected and secured resource server within a few minutes using Java, Maven and Spring Boot.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;springboot-and-oauth2-in-action-1024x346.png&#34; alt=&#34;springboot and oauth2 in action 1024x346&#34;/&gt;
&lt;/div&gt;
&lt;div class=&#34;title&#34;&gt;Figure 1. OAuth2 Flow with Spring Boot in Action&lt;/div&gt;</description>
    </item>
    <item>
      <title>Integrating Swagger into a Spring Boot RESTful Webservice with Springfox</title>
      <link>https://www.hascode.com/integrating-swagger-into-a-spring-boot-restful-webservice-with-springfox/</link>
      <pubDate>Wed, 01 Jul 2015 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/integrating-swagger-into-a-spring-boot-restful-webservice-with-springfox/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Spring Boot allows us to create RESTful web-services with ease, Swagger specifies a format to describe the capabilities and operations of these services and with Swagger UI it is possible to explore our REST API with a nice graphical user interface in our browser.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Springfox is a project that aims at creating automated JSON API documentation for API’s built with Spring and is used in the following tutorial to integrate Swagger into a sample application.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Spring 3, Maven and Annotation Based Configuration</title>
      <link>https://www.hascode.com/spring-3-maven-and-annotation-based-configuration/</link>
      <pubDate>Sun, 22 Aug 2010 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/spring-3-maven-and-annotation-based-configuration/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;There is still the urban myth that using Spring IoC container without thousands lines of XML code isn’t possible – so today we’re taking a look at annotation based configuration with Spring 3 and of course we’re using Maven..&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_setup_your_project&#34;&gt;Setup your project&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Create a simple Maven project using&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;mvn archetype:generate // or
mvn archetype:create&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a lot of dependencies and reference them to the Spring version defined as a property in your &lt;em&gt;pom.xml.&lt;/em&gt; A good reference on Spring 3 and Maven artifacts can be found at &lt;a href=&#34;http://blog.springsource.com/2009/12/02/obtaining-spring-3-artifacts-with-maven/&#34;&gt;Springsource.com&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;properties&amp;gt;
     &amp;lt;org.springframework.version&amp;gt;3.0.0.RELEASE&amp;lt;/org.springframework.version&amp;gt;
 &amp;lt;/properties&amp;gt;
 &amp;lt;dependencies&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-core&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-expression&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;

     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-beans&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-aop&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-context-support&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;${org.springframework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.aspectj&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;com.springsource.org.aspectj.runtime&amp;lt;/artifactId&amp;gt;
         &amp;lt;version&amp;gt;1.6.8.RELEASE&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
 &amp;lt;/dependencies&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Spring Boot Snippets</title>
      <link>https://www.hascode.com/spring-boot-snippets/</link>
      <pubDate>Mon, 01 Mar 2010 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/spring-boot-snippets/</guid>
      <description>&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_define_and_configure_log_groups&#34;&gt;Define and Configure Log Groups&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;admonitionblock tip&#34;&gt;
&lt;table&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td class=&#34;icon&#34;&gt;
&lt;i class=&#34;fa icon-tip&#34; title=&#34;Tip&#34;&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class=&#34;content&#34;&gt;
This allows to configure a group of loggers at the same time
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class=&#34;olist arabic&#34;&gt;
&lt;ol class=&#34;arabic&#34;&gt;
&lt;li&gt;
&lt;p&gt;Define a log group named &lt;code&gt;myaspect&lt;/code&gt; with two packages&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;title&#34;&gt;application.properties&lt;/div&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-properties&#34; data-lang=&#34;properties&#34;&gt;logging.group.myaspect=com.hascode.package1,com.hascode.package2&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the log group and set all loggers to level &lt;code&gt;TRACE&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;title&#34;&gt;application.properties&lt;/div&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-properties&#34; data-lang=&#34;properties&#34;&gt;logging.level.myaspect=TRACE&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This is also possible as parameter on startup&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;java -Dlogging.level.myaspect=TRACE myapp.jar&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_use_junit_5_with_spring_boot&#34;&gt;Use JUnit 5 with Spring Boot&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Use newer versions of Surefire and Failsafe plugins:&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;properties&amp;gt;
[..]
  &amp;lt;maven-failsafe-plugin.version&amp;gt;2.22.0&amp;lt;/maven-failsafe-plugin.version&amp;gt;
  &amp;lt;maven-surefire-plugin.version&amp;gt;2.22.0&amp;lt;/maven-surefire-plugin.version&amp;gt;
&amp;lt;/properties&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
