<?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 Tiago Mesquita on Medium]]></title>
        <description><![CDATA[Stories by Tiago Mesquita on Medium]]></description>
        <link>https://medium.com/@tiagomac?source=rss-64f9823650d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kkbBN9-obsbFxqxkDQZLOg.jpeg</url>
            <title>Stories by Tiago Mesquita on Medium</title>
            <link>https://medium.com/@tiagomac?source=rss-64f9823650d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:20:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tiagomac/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[Consuming a SOAP Webservice with three lines of code in Java]]></title>
            <link>https://medium.com/@tiagomac/consuming-a-soap-webservice-with-three-lines-of-code-in-java-cce98d12453f?source=rss-64f9823650d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/cce98d12453f</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[web-services]]></category>
            <dc:creator><![CDATA[Tiago Mesquita]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 14:37:08 GMT</pubDate>
            <atom:updated>2019-08-14T17:14:40.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JvA1AM9CeZjwJEedzrJTg.jpeg" /></figure><p>How many time do you spend figuring out how to integrate your system? In Java somethings shouldn’t be tough, as in this example that we ‘re going to see.</p><p>For simplicity sake, I’ll use here an open webservice of a Brazilian postal service called “correios”, we’re going to use it’s webservice to search for an address through a CEP given as parameter, the CEP is like our “ZipCode”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*IIeMfSj9z9-eBxasTqME9Q.jpeg" /><figcaption>The <a href="https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl">Correios’ webservice</a> has many services to track the posted items. And of course, they’ll make a way to deliver your package, no matter how 😅.</figcaption></figure><p>For this you won’t need to use dependencies, just pure Java, we’re going to use the *<strong>wsimport</strong> tool here to create all necessary classes, to do so just make sure that you have the <strong><em>%JAVA_HOME%\bin</em></strong> folder correctly configured in you system PATH and then execute the command:</p><p>$ <strong>wsimport</strong> -keep -p github.tiagomac.ws.correios <a href="https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl">https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*K977wzMaPKnzyMDkKTWi7w.png" /><figcaption>Import all generated classes into your project.</figcaption></figure><p>What we just have made here was tell wsimport to generate all necessary classes to consume the services of the given wsdl URL and output it in the package github.tiagomac.ws.correios, then we can import those classes in our project.</p><p>After you have imported the classes, just write a class to consume it, for this example, we making it right in our Main class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/031a82b1992d5d5a6efa16086e6899a0/href">https://medium.com/media/031a82b1992d5d5a6efa16086e6899a0/href</a></iframe><p>And the result given for the CEP “70150903” was:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ef642e739cb5786320210e8a2a05f4c/href">https://medium.com/media/4ef642e739cb5786320210e8a2a05f4c/href</a></iframe><p>That’s all fellows, I hope you enjoyed this brief explanation and to get the code you can follow this <a href="https://github.com/tiagomac/ws-client-example">link to Github</a>.</p><p>And by the way, the CEP “70150903” used in this example is from our Brazilian’s president: Jair Bolsonaro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*_DHsPemM8D8FIvvgq-lxnw.jpeg" /><figcaption>Such a nice guy, take a time to drop by him 🤗.</figcaption></figure><p>*Pay attention: i just figured out that the <strong>wsimport</strong> was deprecated as a part of the JDK (since JDK 11), but was open sourced to the Eclipse Foundation. You can download it with the following link: <a href="https://repo1.maven.org/maven2/com/sun/xml/ws/jaxws-ri/2.3.0/jaxws-ri-2.3.0.zip">https://repo1.maven.org/maven2/com/sun/xml/ws/jaxws-ri/2.3.0/jaxws-ri-2.3.0.zip</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cce98d12453f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring a datasource in Wildfly and connecting to it through Spring Boot]]></title>
            <link>https://medium.com/@tiagomac/configuring-a-datasource-in-wildfly-and-connecting-to-it-through-spring-boot-8c2ef880670b?source=rss-64f9823650d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c2ef880670b</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[jboss]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[datasource]]></category>
            <category><![CDATA[wildfly]]></category>
            <dc:creator><![CDATA[Tiago Mesquita]]></dc:creator>
            <pubDate>Thu, 25 Jul 2019 19:12:01 GMT</pubDate>
            <atom:updated>2019-07-26T12:18:53.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlnLeoanD1SZ8C85olQGiw.jpeg" /><figcaption>A bridge is a path to connect two points</figcaption></figure><p>After my earlier tutorial about how to <a href="https://medium.com/@tiagomac/transforming-a-spring-boot-project-to-deploy-into-wildfly-as-1e0f27cd053d?source=your_stories_page---------------------------">transform a Spring Boot application to make it deployable in Spring Boot</a>, I tought that it would be nice to make a briefly explanation about how to configure a <a href="https://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html">datasource</a> in Wildfly and use it in Spring Boot. For this example i’m using Wildfly 16.0, but the same configuration should work well in previous and maybe future versions too.</p><p>For this example, we gonna configure an Oracle datasource. If we don’t wanna use a datasource (in the case of a self deployable spring boot app) we should instead follow these three simple steps:</p><ol><li>Put all necessary connection configurations in our .properties (or .yml) file.</li><li>Make a <a href="http://twitter.com/Configurator">@Configurator</a> class with <a href="http://twitter.com/EnableTransactionMan">@EnableTransactionMan</a>agement and a <a href="http://twitter.com/EnableJpaRepositorie">@EnableJpaRepositorie</a>s to handle with our entityManagerFactory and transactionManager.</li><li>Configure our JDBC Drive — as we know when we talk about Oracle we can’t just put a dependency in our pom.xml file due to license restriction, instead we have to download and install it, or in a not recommended workaround to do it is to put the library jar directly in our project and copy to our build in compile time (I didn’t want to say that, I don’t agree with it 🙊)</li></ol><p>Now that we saw the old way, let see how to make it as a datasource, so we can easily change between different environments like development, homologation and production:</p><p>First we had to configure our drive in Wildfly, we are going to put the jdbc oracle driver inside Wildfly and tell him that this drive exists, so we can use it when we create the datasource. To install and configure the drive inside Wildfly, follow these two steps:</p><ol><li><a href="https://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html"><em>Download</em></a> and copy your ojdbc[version].jar file to: <strong>…/wildfly-16.0.0.Final/modules/system/layers/base/com/oracle/main</strong> the last three directories you must create if you didn’t have any previous oracle driver installed.</li><li>Create a module.xml file inside of the same folder and put inside it:</li></ol><pre>&lt;module xmlns=&quot;urn:jboss:module:1.1&quot; name=&quot;com.oracle&quot;&gt;</pre><pre>&lt;resources&gt;</pre><pre>&lt;resource-root path=&quot;ojdbc<strong>[version]</strong>.jar&quot;/&gt;</pre><pre>&lt;/resources&gt;</pre><pre>&lt;dependencies&gt;</pre><pre>&lt;module name=&quot;javax.api&quot;/&gt;</pre><pre>&lt;module name=&quot;javax.transaction.api&quot;/&gt;</pre><pre>&lt;/dependencies&gt;</pre><pre>&lt;/module&gt;</pre><p>Remember to change the [version] to adequate to your ojdbc version.</p><p>Done with the Oracle drive installation, we need now to configure our datasource and tell yo our Wildfly about this new module (our Oracle drive), to do so we are going to the standalone.xml that is located in your WILDFLY_HOME/standalone/configuration folder. There you will do these two steps:</p><ol><li>Locate the &lt;datasources&gt; tag and inside it put:</li></ol><pre>&lt;datasource jndi-name=&quot;java:jboss/datasources/myGreatDS&quot; pool-name=&quot;myGreatDS&quot; enabled=&quot;true&quot;&gt;<br>  &lt;connection-url&gt;jdbc:oracle:thin:@<strong>[HOST_NAME]</strong>:1521:<strong>[SID]</strong>&lt;/connection-url&gt;<br>  &lt;driver&gt;oracle&lt;/driver&gt;<br>  &lt;pool&gt;<br>    &lt;min-pool-size&gt;1&lt;/min-pool-size&gt;<br>    &lt;max-pool-size&gt;5&lt;/max-pool-size&gt;<br>    &lt;prefill&gt;true&lt;/prefill&gt;<br>  &lt;/pool&gt;<br>  &lt;security&gt;<br>    &lt;user-name&gt;<strong>[username]</strong>&lt;/user-name&gt;<br>    &lt;password&gt;<strong>[password]</strong>&lt;/password&gt;<br>  &lt;/security&gt;<br>&lt;/datasource&gt;</pre><p>Remember to change all parameters marked with brackets.</p><p>2. Now, in the same file, but inside the &lt;drivers&gt; tag just put:</p><pre>&lt;driver name=&quot;oracle&quot; module=&quot;com.oracle&quot;&gt;<br>  &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;<br>&lt;/driver&gt;</pre><p>Everything configured in Wildfly, our datasource is ready to go. And now, back to our application we are going to make a simple <strong>one line change </strong>😍<strong> </strong>only in our properties file, we just need to put inside it:</p><pre>spring.datasource.jndi-name=java:jboss/datasources/myGreatDS</pre><p>Nothing more is necessary since the dialect will be automatically identified by Hibernate and the spring-boot-starter-data-jpa will handle with all necessary configuration.</p><h3>That’s all fellows!</h3><p>Remember that you can see the project example on <a href="https://github.com/tiagomac/spring-boot-orcl-datasource-example">Github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c2ef880670b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transforming a Spring Boot project to deploy into Wildfly AS]]></title>
            <link>https://medium.com/@tiagomac/transforming-a-spring-boot-project-to-deploy-into-wildfly-as-1e0f27cd053d?source=rss-64f9823650d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e0f27cd053d</guid>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[wildfly]]></category>
            <dc:creator><![CDATA[Tiago Mesquita]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 22:01:01 GMT</pubDate>
            <atom:updated>2019-07-30T20:40:03.429Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXnhbuRpXeWc5J0vDR5J0w.jpeg" /></figure><h3>Sometime changes are necessary…</h3><p>Spring Boot brought an incredible way to develope web applications with Java, all of its “<a href="https://www.javatpoint.com/spring-boot-starters">starters</a>” make our lives pretty better, one of my most loved thing in Spring Boot is its <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html">embedded container</a>, it makes easy to be ready to go, you just build a .jar and deploy it easily with a <strong>$ </strong>java -jar youproject.jar command.</p><p>But sometimes a project requirement may force you to go to a biggest container, an Application Server, being more precise, as the tenebrous Wildfly (A silly name given to our well known JBoss), so here i’ll give you all the necessary things that you should do to migrate your Spring Boot project to Wildfly.</p><p>In this example we assume that you are using the same environment than I:</p><ul><li>Java JDK 8</li><li>Spring Boot 2.0</li><li>Wildfly AS 16</li></ul><p>We’re going to start with the POM.xml, there you’ll make essential changes.</p><ol><li>Because we are going to deploy our application in Wildfly, we need to change its build manner to generate a War package instead of a Jar package: Inside your<strong>&lt;project&gt;</strong> put:</li></ol><p><strong>&lt;packaging&gt;</strong>war<strong>&lt;/packaging&gt;</strong></p><p>2. Now remove the spring-boot-maven-plugin, as it’s not more necessary and will reduce your build size:</p><pre><strong>&lt;plugin&gt;</strong></pre><pre><strong>  &lt;groupId&gt;</strong>org.springframework.boot<strong>&lt;/groupId&gt;</strong></pre><pre><strong>  &lt;artifactId&gt;</strong>spring-boot-maven-plugin<strong>&lt;/artifactId&gt;</strong></pre><pre><strong>&lt;/plugin&gt;</strong></pre><p>3. As we are running our project inside Wildfly we should take off the spring-boot-starter-tomcat too, to do so inside of spring-boot-start-web dependency declaration, put the exclusions tag:</p><pre><strong>&lt;exclusions&gt;</strong></pre><pre><strong>  &lt;exclusion&gt;</strong></pre><pre><strong>    &lt;groupId&gt;</strong>org.springframework.boot<strong>&lt;/groupId&gt;</strong></pre><pre><strong>    &lt;artifactId&gt;</strong>spring-boot-starter-tomcat<strong>&lt;/artifactId&gt;</strong></pre><pre><strong>  &lt;/exclusion&gt;</strong></pre><pre><strong>&lt;/exclusions&gt;</strong></pre><p>4. Now include the javax.servlet API spec as provided (remember that the implementation will be provided by Wildfly):</p><pre><strong>&lt;dependency&gt;</strong></pre><pre><strong>   &lt;groupId&gt;</strong>javax.servlet<strong>&lt;/groupId&gt;</strong></pre><pre><strong>   &lt;artifactId&gt;</strong>javax.servlet-api<strong>&lt;/artifactId&gt;</strong></pre><pre><strong>   &lt;scope&gt;</strong>provided<strong>&lt;/scope&gt;</strong></pre><pre><strong>&lt;/dependency&gt;</strong></pre><p>5. Now the finish step, we need to extends our main application class from SpringBootServletInitializer and override its configure method:</p><pre>...<br>@SpringBootApplication<br><strong>public</strong> <strong>class</strong> SpringBootOrclDatasourceExampleApplication <strong>extends</strong> SpringBootServletInitializer {</pre><pre><strong>@Override<br>protected</strong> SpringApplicationBuilder configure(SpringApplicationBuilder application) {</pre><pre><strong>return</strong> application.sources(getClass());</pre><pre>}</pre><pre>…</pre><p>Remember to import from org.springframework.boot.web.servlet.support.SpringBootServletInitializer if you are using Spring Boot 2.0.</p><p>This last piece of code will tell the SpringBootServletInitializer to start from that point.</p><p>Everything is fine so you can build your WAR file now, to make this you can run the command:</p><blockquote><strong>$</strong>mvn clean package</blockquote><p>Remember that if you have some test class already configured you should face some problems during the package, so to bypass those problems you can run instead:</p><blockquote><strong>$ </strong>mvn clean package -DskipTests=true</blockquote><h3>That’s all fellows!</h3><p>This project example was published in <a href="https://github.com/tiagomac/spring-boot-orcl-datasource-example">Github</a>, enjoy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e0f27cd053d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>