<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Erol Yapıcı on Medium]]></title>
        <description><![CDATA[Stories by Erol Yapıcı on Medium]]></description>
        <link>https://medium.com/@erolyapici?source=rss-d48f6a8126d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*GCTN57U5fc9EJLNaKIgu1g.jpeg</url>
            <title>Stories by Erol Yapıcı on Medium</title>
            <link>https://medium.com/@erolyapici?source=rss-d48f6a8126d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:44:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erolyapici/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How To Generate a PKCS#12 file]]></title>
            <link>https://erolyapici.medium.com/how-to-generate-a-pkcs-12-file-1f4c8307aa7c?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f4c8307aa7c</guid>
            <category><![CDATA[java-keystore]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[pkcs12]]></category>
            <category><![CDATA[openssl]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Sat, 06 Jan 2024 15:05:57 GMT</pubDate>
            <atom:updated>2024-01-06T15:08:33.200Z</atom:updated>
            <content:encoded><![CDATA[<p>This post focuses on generating <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS#12</a> file for serving your content or utilizing it for authentication purposes.</p><p>PKCS #12, also known as “Personal Information Exchange Syntax Standard,” is a binary format used to store cryptographic objects such as private keys, certificates, and the certificate chains that go with them. PKCS #12 is usually connected with the file extensions “.p12” or “.pfx.”</p><p>A PKCS #12 file, also known as a <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS #12</a> archive or PFX file, can include a private key and its corresponding X.509 certificate, as well as the whole certificate chain, including intermediate and root certificates. This format is commonly used for securely transferring and storing private keys and certificates, particularly in SSL/TLS certificates, client authentication, and code signing applications.</p><p>The <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS #12</a> standard defines a structure that can contain the following:</p><ol><li>Private Key: The actual private key associated with the certificate.</li><li>Certificate: The X.509 certificate that corresponds to the private key.</li><li>Certificate Chain: The complete chain of certificates, starting from the end-entity certificate and going up to the root certificate. This includes intermediate certificates as well.</li><li>Additional Certificates (Optional): Any additional certificates that may be part of the trust chain but not directly related to the private key and certificate.</li><li>Password Protection: PKCS #12 files are often password-protected to ensure the confidentiality and integrity of the stored private key and certificate information.</li></ol><p>A PKCS #12 file is useful when you need to securely convey a private key and its accompanying certificate. Common application scenarios include installing SSL/TLS certificates on web servers, providing client authentication certificates, and securely storing cryptographic data.</p><p>In <a href="https://www.openssl.org/">OpenSSL</a>, operations such as <a href="https://www.openssl.org/">openssl</a> pkcs12 are used to generate, alter, and retrieve information from PKCS #12 files. <a href="https://www.openssl.org/">OpenSSL</a>, for example, may export a private key and certificate into a PKCS #12 file or extract the contents of a PKCS #12 file into distinct components.</p><p>The PKCS#12 format shares similarities with the <a href="https://en.wikipedia.org/wiki/Java_KeyStore">Java KeyStore (JKS)</a> format; however, its versatility extends beyond the confines of Java, accommodating usage in diverse programming libraries such as C and C++. This attribute renders PKCS #12 a more generalized choice for a keystore, enabling cross-platform compatibility and utilization across a broader spectrum of programming environments.</p><h4>In the generation of a new PKCS #12 certificate, three distinct methodologies are available:</h4><ul><li>Purchase a certificate issued by a known certificate authority (like VeriSign, Symantec, DigiCert, Thawart, etc).</li><li>Generate your own self-signed SSL certificate</li><li>Create a certificate using the Certificate Signing Request (CSR, a.k.a PKCS #10)</li></ul><h3>1. Purchase a certificate issued by a known certificate authority</h3><p>One approach to obtaining a certificate involves the procurement of a certificate from a reputable Certificate Authority (CA) through a monetary transaction. This involves the subsequent amalgamation of the purchased public certificate with its corresponding private key. Alternatively, for those seeking a cost-free option, Let’s Encrypt provides a service that issues SSL/TLS certificates without charge. In such instances, the acquired public certificate from Let’s Encrypt is combined with its associated private key, resulting in the creation of a PKCS #12 file as a no-cost alternative for certificate generation.</p><pre>openssl pkcs12 -export -out keyStore.p12 -inkey privateKey.pem -in certificate.crt</pre><h3>2. Create your own self-signed SSL certifiate</h3><pre>openssl req -x509 -newkey rsa:4096 -keyout privateKey.pem -out certificate.crt -days 3650 -nodes</pre><h4>Explanation of the parameters:</h4><ul><li>req: This specifies the OpenSSL utility for creating and processing certificate requests.</li><li>-x509: This option specifies that the output should be a self-signed certificate rather than a certificate request.</li><li>-newkey rsa:4096: This part of the command generates a new RSA private key with a key size of 4096 bits.</li><li>-keyout privateKey.pem: This specifies the file where the private key should be saved.</li><li>-out certificate.crt: This specifies the file where the self-signed certificate should be saved.</li><li>-days 3650: This sets the validity period of the certificate to 3650 days (approximately 10 years). Adjust this value as needed.</li><li>-nodes: This option specifies that the private key should not be encrypted with a passphrase. Including this option means that the private key will be in a non-encrypted form.</li></ul><h4>2.1 Combine a private key and a certificate into one key store in the PKCS #12 format</h4><pre>openssl pkcs12 -export -out keyStore.p12 -inkey privateKey.pem -in certificate.crt</pre><h4>Explanation of the parameters:</h4><ul><li>pkcs12: This specifies the OpenSSL utility for PKCS#12 file operations.</li><li>-export: This option instructs OpenSSL to export the private key and the certificate into a PKCS#12 file.</li><li>-out keyStore.p12: This specifies the file name for the PKCS12 file that will be created.</li><li>-inkey privateKey.pem: This specifies the input file containing the private key.</li><li>-in certificate.crt: This specifies the input file containing the certificate.</li></ul><p>After running this command, you should have a keyStore.p12 file that contains both the private key and the certificate. You may be prompted to set a password for the PKCS12 file during the process. If you want to set a specific password, you can use the -passout pass:your_password option, replacing your_password with your chosen password:</p><h3>3. Create a certificate using the Certificate Signing Request</h3><h4>3.1 Generate a private key and a certificate signing request into separated files</h4><pre>openssl req -new -newkey rsa:4096 -out request.csr -keyout myPrivateKey.pem -nodes</pre><h4>Explanation of the parameters:</h4><ul><li>req: This specifies the OpenSSL utility for creating and processing certificate requests.</li><li>-new: This option specifies that a new CSR is being generated.</li><li>-newkey rsa:4096: This part of the command generates a new RSA private key with a key size of 4096 bits.</li><li>-out request.csr: This specifies the file where the certificate request (CSR) should be saved.</li><li>-keyout myPrivateKey.pem: This specifies the file where the new private key should be saved.</li><li>-nodes: This option specifies that the private key should not be encrypted with a passphrase. Including this option means that the private key will be in a non-encrypted form.</li></ul><p>Following the execution of this command, you should have a new RSA private key in myPrivateKey.pemand a certificate request in request.csr. This certificate request can then be forwarded to a certificate authority (CA) in order to get a signed certificate.</p><p>If you want to encrypt the private key with a passphrase, you can omit the -nodes option, and OpenSSL will prompt you to set a passphrase for the private key during the process. If you want to set a specific passphrase in a non-interactive way, you can use the -passout pass:your_password option:</p><pre>openssl req -new -newkey rsa:4096 -out request.csr -keyout myPrivateKey.pem -passout pass:your_password</pre><p>Replace your_password with your chosen passphrase. Keep in mind that handling passphrase-protected private keys securely is crucial for the security of your cryptographic materials.</p><h4>3.2 Generate a certificate signing request from an existing private key</h4><pre>openssl req -new -key myPrivateKey.pem -out request.csr</pre><ul><li>req: This specifies the OpenSSL utility for creating and processing certificate requests.</li><li>-new: This option specifies that a new CSR is being generated.</li><li>-key myPrivateKey.pem: This specifies the existing private key file to be used in generating the CSR.</li><li>-out request.csr: This specifies the file where the certificate request (CSR) should be saved.</li></ul><p>Following the execution of this command, you will have a new certificate request (request.csr) connected with the private key (myPrivateKey.pem). This CSR can then be sent to a certificate authority (CA) to get a signed certificate.</p><p>If the private key is password-protected, OpenSSL will request you to enter the passphrase. If you want to supply the pass without any interaction, use the -passin pass:your_password option, replacing your_password with the real pass:</p><pre>openssl req -new -key myPrivateKey.pem -out request.csr -passin pass:your_password</pre><p>Remember to handle passphrase-protected private keys securely and only share the passphrase with those who need it.</p><p>You are almost done. When you get a new certificate for your request.csr from your CA, use it together with a private key to create a PKCS#12 file:</p><h4>3.3 Combine a private key and a certificate into one key store in the PKCS #12 format</h4><pre>openssl pkcs12 -export -out keyStore.p12 -inkey privateKey.pem -in certificate.crt -certfile CA.crt</pre><ul><li>pkcs12: This specifies the OpenSSL utility for PKCS#12 file operations.</li><li>-export: This option instructs OpenSSL to export the private key and the certificate into a PKCS#12 file.</li><li>-out keyStore.p12: This specifies the file name for the PKCS12 file that will be created.</li><li>-inkey privateKey.pem: This specifies the input file containing the private key.</li><li>-in certificate.crt: This specifies the input file containing the certificate.</li><li>-certfile CA.crt: This specifies additional CA certificates (Certificate Authority certificates) that should be included in the PKCS#12 file. This is useful when creating a PKCS#12 file for client authentication where the certificate chain needs to be included.</li></ul><p>After running this command, you should have a keyStore.p12 file that contains both the private key and the certificate along with the CA certificates. You may be prompted to set a password for the <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS#12</a> file during the process. If you want to set a specific password, you can use the -passout pass:your_password option:</p><pre>openssl pkcs12 -export -out keyStore.p12 -inkey privateKey.pem -in certificate.crt -certfile CA.crt -passout pass:your_password</pre><p>Remember to handle the <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS#12</a> file and its password securely, as it may contain sensitive information.</p><h3>Conclusion</h3><p>The main point of the text is that a <a href="https://en.wikipedia.org/wiki/PKCS_12">PKCS#12</a> file is a binary format used to store cryptographic objects such as private keys, certificates, and certificate chains. It is commonly used for securely transferring and storing private keys and certificates, particularly in SSL/TLS certificates, client authentication, and code signing applications. The text also provides instructions on how to create a PKCS#12 file using OpenSSL.</p><p>Related Links:</p><p><a href="https://blog.pavelsklenar.com/">https://blog.pavelsklenar.com</a></p><p><a href="https://en.wikipedia.org/wiki/PKCS_12">https://en.wikipedia.org/wiki/PKCS_12</a></p><p><a href="https://www.openssl.org/docs/">https://www.openssl.org/docs/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f4c8307aa7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effectively using MapStruct and Lombok]]></title>
            <link>https://erolyapici.medium.com/effectively-using-mapstruct-and-lombok-496f06122c58?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/496f06122c58</guid>
            <category><![CDATA[lombok]]></category>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[mapstruct]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Sat, 20 Aug 2022 14:40:36 GMT</pubDate>
            <atom:updated>2022-08-20T14:40:36.422Z</atom:updated>
            <content:encoded><![CDATA[<p>MapStruct and Lombok are libraries, which can make developer’s life as much easier. Because, MapStruct and Lombok save time to developers.</p><h3>What is MapStruct?</h3><p>MapStruct is a code generator that greatly simplifies the implementation of mappings between Java bean types based on a convention over configuration approach.</p><h3>What is Lombok?</h3><p>Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.<br>Never write another getter or equals method again, with one annotation your class has a fully featured builder, automate your logging variables, and much more.</p><h3>Using MapStruct with Lombok</h3><ol><li>Create <strong>lombok.config</strong> in the root of our project. It will be automatically be picked up.</li></ol><pre>lombok.addLombokGeneratedAnnotation=true<br>lombok.anyConstructor.addConstructorProperties=true</pre><h3>Initial Maven Dependencies</h3><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.mapstruct&lt;/groupId&gt;<br>    &lt;artifactId&gt;mapstruct&lt;/artifactId&gt;<br>    &lt;version&gt;1.5.2.Final&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;<br>    &lt;artifactId&gt;lombok&lt;/artifactId&gt;<br>    &lt;scope&gt;provided&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><h3>Maven Annotation Processing Configuration</h3><p>We need to configure the Maven Compiler plugin to support the annotation processors of MapStruct and Project Lombok. Make sure versions are match each other.</p><blockquote>If you are using Lombok 1.18.16 or newer you also need to add <a href="https://search.maven.org/artifact/org.projectlombok/lombok-mapstruct-binding">lombok-mapstruct-binding</a> in order to make Lombok and MapStruct work together.</blockquote><blockquote>Maven-compiler-plugin’s version has to be greater than 3.8.0</blockquote><pre>&lt;build&gt;<br>    &lt;plugins&gt;<br>        &lt;plugin&gt;<br>            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>            &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>            &lt;version&gt;3.10.1&lt;/version&gt;<br>            &lt;configuration&gt;<br>                &lt;source&gt;11&lt;/source&gt;<br>                &lt;target&gt;11&lt;/target&gt;<br>                &lt;annotationProcessorPaths&gt;<br>                    &lt;path&gt;<br>                        &lt;groupId&gt;org.mapstruct&lt;/groupId&gt;<br>                        &lt;artifactId&gt;mapstruct-processor&lt;/artifactId&gt;<br>                        &lt;version&gt;1.5.2.Final&lt;/version&gt;<br>                    &lt;/path&gt;<br>                    &lt;path&gt;<br>                        &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;<br>                        &lt;artifactId&gt;lombok&lt;/artifactId&gt;<br>                        &lt;version&gt;1.18.20&lt;/version&gt;<br>                    &lt;/path&gt;<br>                    &lt;path&gt;<br>                        &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;<br>                        &lt;artifactId&gt;lombok-mapstruct-binding&lt;/artifactId&gt;<br>                        &lt;version&gt;0.2.0&lt;/version&gt;<br>                    &lt;/path&gt;<br>                &lt;/annotationProcessorPaths&gt;<br>                &lt;compilerArgs&gt;<br>                    &lt;compilerArg&gt;<br>                        -Amapstruct.defaultComponentModel=spring<br>                    &lt;/compilerArg&gt;<br>                &lt;/compilerArgs&gt;<br>            &lt;/configuration&gt;<br>        &lt;/plugin&gt;<br>    &lt;/plugins&gt;<br>&lt;/build&gt;</pre><blockquote>If you want to create bean all mapper, you can add -Amapstruct.defaultComponentModel=spring on compilerArg<br>or @Mapper(componentModel = “spring”)</blockquote><p>Lets create Dtos</p><pre>@Getter<br>@AllArgsConstructor<br>@Builder<br>class UserRequest extends BaseRequest{<br>    private String id;<br>    private String name;<br>}</pre><pre>@Getter<br>@AllArgsConstructor<br>@SuperBuilder<br>class UserEntity extends BaseEntity{<br>    private String id;<br>    private String name;<br>}</pre><blockquote>If you want to use builder pattern with MapStruct, you have to use @SuperBuilder for complies the extended properties. Otherwise MapStruct couldn’t compile extented properties.</blockquote><p>Let’s create Interface</p><pre>@Mapper(componentModel = &quot;spring&quot;)//Creates a Spring Bean automatically<br>public interface UserMapper {<br>    UserMapper <em>INSTANCE </em>= Mappers.<em>getMapper</em>(UserMapper.class);<br><br>    UserEntity requestToEntity(UserRequest request);<br>}</pre><p>Now run the maven build and have a look at the implementation UserMapperImpl</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=496f06122c58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot 1.5.x to 2.x Story]]></title>
            <link>https://erolyapici.medium.com/spring-boot-1-5-x-to-2-x-story-25ab51e9e0a?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/25ab51e9e0a</guid>
            <category><![CDATA[spring-boot-migration]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-boot-2]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Fri, 26 Feb 2021 12:06:51 GMT</pubDate>
            <atom:updated>2021-02-26T12:06:51.247Z</atom:updated>
            <content:encoded><![CDATA[<h3>Spring Boot 1.5.x to 2.x Migration Story</h3><p>Mark Reinhold, chief architect of Oracle’s Java Platform Group, says on his <a href="https://mreinhold.org/blog/forward-faster">blog</a> “For Java to remain competitive it must not just continue to move forward — it must move forward faster.”</p><p>After 2018 java released every 6 months so what will happen spring boot project?</p><p>Spring boot 1.x line reached end of life. They announced at august 2019 own blog <a href="https://spring.io/blog/2019/08/06/it-is-time-goodbye-spring-boot-1-x">site</a>. Unlike previous versions, the migration to the newer releases have some changes.</p><h3>Why upgrade?</h3><ul><li>Upgrading java version</li><li>Using gzip all request method(for jetty server)</li><li>want to use <a href="https://github.com/resilience4j/resilience4j">Resilience4J</a> for circuit breaker</li><li>upgrade spring-kafka client vs</li></ul><h3>How</h3><p>Our spring boot project dependencies :</p><p><a href="https://github.com/erolyapici/spring-boot-upgrade/tree/master/1.5">https://github.com/erolyapici/spring-boot-upgrade/tree/master/1.5</a></p><pre>&lt;parent&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;<br>    &lt;version&gt;2.4.2&lt;/version&gt;<br>    &lt;relativePath/&gt;<br>&lt;/parent&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;<br>    &lt;version&gt;2020.0.0&lt;/version&gt;<br>    &lt;type&gt;pom&lt;/type&gt;<br>    &lt;scope&gt;import&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><p>And changed config</p><pre>server:<br>  servlet-path: /application-name<br>spring:<br>  profiles: dev,test</pre><p>to</p><pre>server:<br>  servlet:<br>    context-path: /application-name<br>spring:<br>  config:<br>    activate:<br>      on-profile: dev,test</pre><h3>Spring Boot Actuator Changes</h3><ul><li>All endpoints have moved to /actuator by default.<br>If you want to change use this config</li></ul><pre>management.endpoints.web.base-path=/<br></pre><p>Spring actuator changed config =&gt;</p><p><a href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#configuration-keys-structure">https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#configuration-keys-structure</a></p><h3><strong>Prometheus Changes</strong></h3><p><a href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes#micrometer">Spring Boot 2.0 no</a> longer ships with its own metrics APIs. Instead we rely on <a href="https://micrometer.io/">micrometer.io</a> for all application monitoring needs.</p><p>add prometheus dependency on pom xml</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>    &lt;artifactId&gt;micrometer-registry-prometheus&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Add new config</p><pre>spring.jmx.enabled=true<br>management.endpoint.metrics.enabled=true<br>management.endpoints.web.exposure.include=*<br>management.endpoints.web.base-path=/<br>management.metrics.export.prometheus.enabled=true</pre><h3>Consul Changes</h3><p>Reference <a href="https://docs.spring.io/spring-cloud-consul/docs/3.0.1/reference/html/">https://docs.spring.io/spring-cloud-consul/docs/3.0.1/reference/html/</a></p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-starter-consul-config&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-starter-bootstrap&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h3><strong>Caching</strong></h3><p><strong>Dedicated Hazelcast Auto-configuration for Caching</strong></p><p>It is no longer possible to auto-configure both a general HazelcastInstance and a dedicated HazelcastInstance for caching. As a result, the spring.cache.hazelcast.config property is no longer available.</p><p><strong>GuavaCacheManager</strong></p><p>Support for Guava has been <a href="https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-5.x#dropped-support">dropped</a> in Spring Framework 5. If you were are using GuavaCacheManager, <a href="https://github.com/ben-manes/caffeine">Caffeine</a> (com.github.ben-manes.caffeine:caffeine) and CaffeineCacheManager should be used instead.</p><pre>GuavaCacheManager guavaCacheManager = new GuavaCacheManager();<br>guavaCacheManager.setCacheBuilder(CacheBuilder.newBuilder()<br>    .expireAfterWrite(1, CACHE_TIME_UNIT));<br>to</pre><pre>CaffeineCacheManager cacheManager = new CaffeineCacheManager();<br>cacheManager.setCaffeine(Caffeine.newBuilder()<br>    .expireAfterWrite(1, CACHE_TIME_UNIT));</pre><p><strong>RedisCacheManager</strong></p><p>The Redis CacheManager implementation has been reworked significantly, make sure to review the <a href="https://docs.spring.io/spring-data/data-redis/docs/2.0.9.RELEASE/reference/html/#redis:support:cache-abstraction">reference documentation</a>.</p><h3>JUnit5</h3><p><strong>spring-boot-starter-test</strong> now provides JUnit 5 by default. JUnit 5’s vintage engine is included by default to support existing JUnit 4-based test classes so that you can migrate to JUnit 5 when you are ready to do so. It is also possible to use a mixture of JUnit 4- and JUnit 5-based test classes in the same module. This allows you to migrate to JUnit 5 gradually if you wish.</p><h3>Circuit Breaker</h3><p>spring-cloud-netflix-hystrix removed at spring Cloud 2020.0 release.</p><p>You can add the dependency your project.</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-starter-netflix-hystrix&lt;/artifactId&gt;<br>    &lt;version&gt;${spring-cloud-starter-netflix-hystrix.version}&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h3>Mockito Updates</h3><p>Remove old mockito dependecy from pom.xml . The new mockito dependency comes from new boot version.</p><p>MockitoAnnotations.initMocks(this) to MockitoAnnotations.openMocks(this)</p><p>org.mockito.runners.MockitoJUnitRunner to org.mockito.junit.MockitoJUnitRunner</p><p>import static org.mockito.Matchers to import static org.mockito.ArgumentMatchers</p><p>In conclusion, we can say there few changes to migration spring boot 1.5.x to 2.x can be easily overcome. Maybe I may not written the minor changes but I will update If I get new changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25ab51e9e0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hystrix Configuration in Properties file]]></title>
            <link>https://erolyapici.medium.com/hystrix-configuration-in-properties-file-2fc90e330f08?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fc90e330f08</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[hystrix]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 17:58:26 GMT</pubDate>
            <atom:updated>2019-12-16T17:58:26.882Z</atom:updated>
            <content:encoded><![CDATA[<p>We use netflix hystrix circuit breaker our microservices. We use hystrix annotation like this:</p><pre>@HystrixCommand(fallbackMethod = &quot;getEmptyResult&quot;,<br>        threadPoolKey = &quot;getProductThreadPool&quot;,<br>        commandProperties = {<br>                @HystrixProperty(name = &quot;execution.isolation.thread.timeoutInMilliseconds&quot;, value = &quot;50&quot;),<br>                @HystrixProperty(name = &quot;circuitBreaker.requestVolumeThreshold&quot;, value = &quot;10&quot;),<br>                @HystrixProperty(name = &quot;circuitBreaker.sleepWindowInMilliseconds&quot;, value = &quot;1000&quot;),<br>                @HystrixProperty(name = &quot;circuitBreaker.errorThresholdPercentage&quot;, value = &quot;10&quot;),<br>                @HystrixProperty(name = &quot;execution.isolation.strategy&quot;, value = &quot;THREAD&quot;),<br>                @HystrixProperty(name = &quot;metrics.rollingStats.timeInMilliseconds&quot;, value = &quot;20000&quot;),<br>                @HystrixProperty(name = &quot;metrics.rollingPercentile.timeInMilliseconds&quot;, value = &quot;20000&quot;),<br>                @HystrixProperty(name = &quot;metrics.healthSnapshot.intervalInMilliseconds&quot;, value = &quot;5000&quot;),<br>                @HystrixProperty(name = &quot;fallback.isolation.semaphore.maxConcurrentRequests&quot;, value = &quot;100&quot;)<br>        },<br>        threadPoolProperties = {<br>                @HystrixProperty(name = &quot;coreSize&quot;, value = &quot;30&quot;),<br>                @HystrixProperty(name = &quot;maxQueueSize&quot;, value = &quot;-1&quot;),<br>        }<br>)<br>@Override<br>public ProductDto getProduct(Integer productId) {<br>   ... call other microservices<br>}<br><br>private ProductDto getEmptyResult(Integer productId, Throwable error) {<br>    logger.warn(&quot;logFor=CircuitBreaker productId={}, method={}, exception={}&quot;, productId,<br>            &quot;getProduct&quot;, error);<br>    return <em>null</em>;<br>}</pre><p>So I want to move this config our configuration files. I search how can I do it so I check hystrix documentation page <a href="https://github.com/Netflix/Hystrix/wiki/Configuration#command-properties">https://github.com/Netflix/Hystrix/wiki/Configuration#command-properties</a></p><p>There is command properties tag we can easy to use properties file hystrix configuration.</p><p>We can do like this;</p><pre>hystrix.command.{commandKey}.{propertiesName}=value<br>OR <br>hystrix.command.default.{propertiesName}=value</pre><p>If properties not found commendKey hystrix use default config.</p><p>For example</p><pre>hystrix.commeand.productCommandKey.execution.isolation.thread.timeoutInMilliseconds=50<br>hystrix.commeand.default.circuitBreaker.requestVolumeThreshold=10</pre><p>Change the annotation properties. We use threadPoolKey and commandKey properties file</p><pre>@HystrixCommand(fallbackMethod = &quot;getEmptyResult&quot;,<br>        threadPoolKey = &quot;getProductThreadPool&quot;,<br>        commandKey = &quot;getProductServiceCommand&quot;<br>)<br>@Override<br>public ProductDto getProduct(Integer productId) {<br>   ... call other microservices<br>}<br><br>private ProductDto getEmptyResult(Integer productId, Throwable error) {<br>    logger.warn(&quot;logFor=CircuitBreaker productId={}, method={}, exception={}&quot;, productId,<br>            &quot;getProduct&quot;, error);<br>    return <em>null</em>;<br>}</pre><p>Add the properties file this configs</p><pre>hystrix.command.getProductServiceCommand.execution.isolation.thread.timeoutInMilliseconds=50<br>hystrix.command.getProductServiceCommand.circuitBreaker.requestVolumeThreshold=10<br>hystrix.command.getProductServiceCommand.circuitBreaker.sleepWindowInMilliseconds=1000<br>hystrix.command.getProductServiceCommand.circuitBreaker.errorThresholdPercentage=10<br>hystrix.command.getProductServiceCommand.execution.isolation.strategy=THREAD<br>hystrix.command.getProductServiceCommand.metrics.rollingStats.timeInMilliseconds=20000<br>hystrix.command.getProductServiceCommand.metrics.rollingPercentile.timeInMilliseconds=20000<br>hystrix.command.getProductServiceCommand.metrics.healthSnapshot.intervalInMilliseconds=5000<br>hystrix.command.getProductServiceCommand.fallback.isolation.semaphore.maxConcurrentRequests=100</pre><pre>hystrix.threadpool.getProductServiceThreadPool.coreSize=30<br>hystrix.threadpool.getProductServiceThreadPool.maxQueueSize=-1</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fc90e330f08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot 1.5.x Gzip implementation story]]></title>
            <link>https://erolyapici.medium.com/spring-boot-1-5-x-gzip-implementation-story-14c2a68e2116?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/14c2a68e2116</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[jetty]]></category>
            <category><![CDATA[gzip]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 17:36:27 GMT</pubDate>
            <atom:updated>2019-12-16T17:36:27.023Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week we want to compress responses so we open gzip compress our spring boot micro services. It is easy to open gzip compensation for spring boot. We added the properties.</p><pre># Enable response compression<br>server.compression.enabled=true<br><br># The comma-separated list of mime types that should be compressed<br>server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json<br><br># Compress the response only if the response size is at least 1KB<br>server.compression.min-response-size=1024</pre><p>It is easy to enable gzip I check get method the rest services. It’s works! But there is problem which is not get request method services. I request other services which are post request methods but it is not working.(checked put,delete request methods) After that I debug spring boot project so I found JettyEmbeddedServletContainerFactory and creating gziphandler method.</p><p>I realize gziphandler method only enable GET methods :( <strong>GzipHandler constructor only set GET methods so spring boot 1.5.x not override</strong></p><pre>Jetty93GzipHandlerFactory<br>@Override<br>public HandlerWrapper createGzipHandler(Compression compression) {<br>   GzipHandler handler = new GzipHandler();<br>   handler.setMinGzipSize(compression.getMinResponseSize());<br>   handler.setIncludedMimeTypes(compression.getMimeTypes());<br>   if (compression.getExcludedUserAgents() != null) {<br>      handler.setExcludedAgentPatterns(compression.getExcludedUserAgents());<br>   }<br>   return handler;<br>}<br>GzipHandler class constructor</pre><pre><em>/**<br> * Instantiates a new GzipHandler.<br> */<br></em>public GzipHandler()<br>{<br>    _methods.include(HttpMethod.<em>GET</em>.asString());<br>    for (String type:MimeTypes.<em>getKnownMimeTypes</em>())<br>    {<br>        if (&quot;image/svg+xml&quot;.equals(type))<br>            _paths.exclude(&quot;*.svgz&quot;);<br>        else if (type.startsWith(&quot;image/&quot;)||<br>            type.startsWith(&quot;audio/&quot;)||<br>            type.startsWith(&quot;video/&quot;))<br>            _mimeTypes.exclude(type);<br>    }<br>    _mimeTypes.exclude(&quot;application/compress&quot;);<br>    _mimeTypes.exclude(&quot;application/zip&quot;);<br>    _mimeTypes.exclude(&quot;application/gzip&quot;);<br>    _mimeTypes.exclude(&quot;application/bzip2&quot;);<br>    _mimeTypes.exclude(&quot;application/brotli&quot;);<br>    _mimeTypes.exclude(&quot;application/x-xz&quot;);<br>    _mimeTypes.exclude(&quot;application/x-rar-compressed&quot;);<br><br>    if (<em>LOG</em>.isDebugEnabled())<br>        <em>LOG</em>.debug(&quot;{} mime types {}&quot;,this,_mimeTypes);<br>    <br>    _agentPatterns.exclude(&quot;.*MSIE 6.0.*&quot;);<br>}</pre><p>After that I check spring boot 2.2 same method. Spring boot override requestMethod when creating GzipHandler.</p><p>Spring boot 2.2.* version</p><pre>JettyHandlerWrappers<br>static HandlerWrapper createGzipHandlerWrapper(Compression compression) {<br>   GzipHandler handler = new GzipHandler();<br>   handler.setMinGzipSize((int) compression.getMinResponseSize().toBytes());<br>   handler.setIncludedMimeTypes(compression.getMimeTypes());<br>   for (HttpMethod httpMethod : HttpMethod.<em>values</em>()) {<br>      handler.addIncludedMethods(httpMethod.name());<br>   }<br>   if (compression.getExcludedUserAgents() != null) {<br>      handler.setExcludedAgentPatterns(compression.getExcludedUserAgents());<br>   }<br>   return handler;<br>}</pre><p><strong>Conclusion</strong></p><p>Spring boot 1.5.x jetty server working gzip only request method get</p><p>Spring boot after 2.x jetty server working all request methods</p><p>If you using tomcat it is okey all request method for gzip.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c2a68e2116" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arşimet Parşömen ve İstanbul]]></title>
            <link>https://erolyapici.medium.com/ar%C5%9Fimet-par%C5%9F%C3%B6men-ve-i%CC%87stanbul-8083e60b3f02?source=rss-d48f6a8126d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8083e60b3f02</guid>
            <category><![CDATA[history]]></category>
            <category><![CDATA[istanbul]]></category>
            <dc:creator><![CDATA[Erol Yapıcı]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 21:02:27 GMT</pubDate>
            <atom:updated>2019-09-18T21:02:27.608Z</atom:updated>
            <content:encoded><![CDATA[<h3>Arşimet Parşömenleri ve İstanbul</h3><p>Arşimet, antik Yunan matematikçi, fizikçi, astronom, filozof ve mühendis. Antik dünyanın ilk ve en büyük bilim adamı kabul edilir. Bir gün hamamda yıkanırken suyun kaldırma kuvvetini bulur.</p><p>Dokuzuncu ve onuncu yüzyıllar Bizans İmparatorluğunun en gösterişli yıllarıydı. Ve Konstantinapolis(İstanbul) kopya çıkarma ve koruma işleminde antik dönemdeki bilgileri orta çağa ulaşmasını sağlayan bir merkezdi. Arşimet parşömenleri bunlardan birkaçıydı. Onuncu yüzyılda, Arşimet’in Metot, Stomachion ve Yüzen Cisimler adlı üç önemli eseri, yine Konstantinopoli’te kopyalandı.</p><p>Fakat yıllar sonra 1204&#39;te, Papa 3. İnnocentius’un çağrısıyla yola çıkan 4. Haçlı Seferi’nin askerleri, asıl hedef olan Kudüs’e varmaya bile gerek duymadan, dönemin en zengin kenti Konstantinopolis’teki ganimetin büyüsüne kapılarak şehri yamaladı. Bundan sonraki yıllarda matematiğe duyulan ilgi azaldı. Arşimet’in parşömenleri ise geri dönüşüme tabi tutuldu. Parşömenlerin hammaddesi deriydi. Ve bu derinin hazırlanması çok zahmetliydi bundan dolayı zaman zaman eski yazıları silinip üzerine yenileri yazılıyordu. Arşimet’in metinleride bu şekilde geri dönüşüme tutuldu ve Hristiyan bir dua kitabı için yenilendi.</p><p>Hattat İonanes Myronas, dua kitabını yazma işini 14 Nisan 1229&#39;da tamamladı. Büyük bir şans eseri, yıkama işlemi parşömenlerin üzerindeki orjinal yazıyı tamamen silememişti.</p><p>Silinmeyen yazılar Arşimet’in metinleriydi. On altıncı yüyyılda, nasıl olduysa bu dua kitabı Kutsal Topraklar’a gitti ve Batı Şeria’daki Beytlehem kentinin birkaç kilometre doğusunda bulunan St. Sabas Manastı’nın kütüphanesinde yerini aldı. Daha sonra bilinmeyen bir sebeple bu parşömen İstanbul’a döndü. Alman bilim adamı Constantine Tischendorf(1815–1874), İstanbul’daki Ortodoks Patrikhanesi’ni ziyaret etti ve el yazmasının orada gördü. Tischendorf, alttan göz kırpan silik matematik metinlerini çok ilginç bulmuş olmalı ki, kitabın bir sayfasını yırtıp çalmış. Daha sonra, Tischendorf mirasçıları o sayfayı 1879 yılında Cambridge Üniversite Kütüphanesine satmış.</p><p>1899&#39;da Papadopoulıs Kerameus adlı bir Yunan akademisyen, bu parşömenleri katalogladı.</p><p>1854–1928 Danimarkalı filoloji uzmanı Johan Ludwig Heiberg yaptığı araştırmalar sonucunda bu metinlerin Arşimet’in yedi tezini içeriyordu ve Arşimet’in var olan yazıların en eski kopyası ve “Metot” ve “Stomachion” isimli metinlerin tek kaynağıydı.</p><p>Heiberg 1908 yılında son kez çalıştıktan sonra parşömenler ortadan kayboldu. Ve 90 yıl sonra, bir Christie’s müzayedesinde, Fransız bir ailenin özel koleksiyonundan çıkıverdi. Aile parşömenlerin 1920&#39;lerden beri kendilerin olduğunu iddia ediyordu. Bazı sayfaları kayıptı. En önemlisi Arşimet metinlerini içeren ve Heiberg’in çevirsini yaptığı sayfalarında üçü ortada yoktu. İkinci olarak, uygun koşullarda muhafaza edilmeyen parşömenlerin bazı bölümleri telefisi mümkün olmayacak şekilde küflenip bozulmuştu. Son olarak, kitabın dört sayfasına, kitaba daha zengin göstermesi için, Bizans sitili dört resim eklenmişti.</p><p>Parşömen 28 Ekim 19982de New York’ta açık artırmaya çıktığından Yunanistan hükümeti ve Yunan Psikoposluk’u satışın durdurulması için harekete geçti ve kitabın 1920 lerde kendilere ait olan bir manastırdan çalınmış olduğunu iddia etti. Fakat bu girişim başarısız oldu. Kitap 2 milyon dolarak açık artırmada satıldı. Kitabı satın alan ve adı açıklanmayan kişi bu eşşiz yapıtı korunması ve üzerinde akademik çalışma yapılması için Baltimore’daki Walters Sanat Müzesine bağışladı.</p><p>Bu kadar değerli bir eserin bu halde yok olup gitmesi bizim için çok büyük bir kayıp :(</p><p>Kaynak: Tanrı Matematikçi Mi? Maroi LIVIO</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8083e60b3f02" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>