Skip to content

Java

Alterar o container padrão do Spring Boot

Change Spring Boot embedded container logo


Este tutorial irá mostrar como alterar o container padrão do Spring Boot, para podermos utilizar o Jetty ou o Undertow ao invés do Tomcat.

O projeto Spring Boot Starter Web já vêm com Spring MVC e o container Tomcat integrados, os quais são empacotados juntos com o jar executável do Spring Boot. Deste modo, tudo que você precisa para executar sua aplicação já está incluído neste arquivo jar.

No entanto, é possível substituirmos o container padrão do Tomcat por outro container de sua escolha, então irei mostrar os passos necessários para isso.

Read More »Alterar o container padrão do Spring Boot

Change Spring Boot embedded container

Change Spring Boot embedded container logo


This tutorial will show you show to change Spring Boot embedded container from its default Tomcat, to an alternative Jetty or Undertow.

The project Spring Boot Starter Web ships with Spring MVC and a Tomcat embedded container that at build time, is packaged within the executable jar file of the standalone Spring Boot application, so everything you need to run the application including the web container itself, is included in that jar.

However, you may want to change Tomcat for another container of your choice by whatever it is the reason, so I will going to show the required steps.

Read More »Change Spring Boot embedded container

Spring Boot Hello World

Spring Boot Hello World logo


Este tutorial irá mostrar como facilmente criar um Hello World com Spring Boot, explicando alguns conceitos sobre essa produtiva ferramenta.

Por que Spring Boot?

O ecossistema do Spring vem se tornando muito amplo durante estes anos, possibilitando a utilização de injeção de dependências, criação de APIs RESTful, processamento em batch com acesso a banco de dados e mais, muito mais. Porém, a configuração inicial e as vezes, até a manutenção de tais projetos pode se tornar um pouco bagunçada devido a quantidade de frameworks co-existindo um com o outro.

Além do mais, aplicações monolitas, na maior parte das vezes, atingem escalabilidade apenas como um todo ao invés de escalar apenas os recursos mais utilizados de forma a aprimorar a utilização de recursos computacionais.

O Spring Boot vem para resolver todos esses problemas, provendo aplicações standalone a nível de produção e convenção ao invés de configuração, facilitando o caminho para que você possa começar a escrever o código que realmente importa: sua lógica de negócio.

Agora que você já sabe o quão importante o Spring Boot é, vamos ao tutorial!

Pré-requisitos

Read More »Spring Boot Hello World

Spring Boot Hello World

Spring Boot Hello World logo


This tutorial will show you how to easily create a Spring Boot Hello World and explain a few concepts about this simple and productive tool.

Why Spring Boot?

The Spring ecosystem has become very large over the years, making it possible to to use dependency injection, create RESTful API’s, process batch jobs with database access and more, much more. However, the initial setup and sometimes the maintenance of such projects would be a bit messy with a considerable amount of different frameworks coexisting with each other.

Moreover, monolithic applications most of the time can only escalate as a whole, but not just their most frequently used features in order to improve computational resources usage.

Spring Boot comes to solve all of these problems, providing production ready stand-alone applications and convention over configuration settings, to let you start coding what really matters as fast as possible: your business logic.

Now that you know how important Spring Boot is, let’s go to the tutorial.

Pre-requisites

Read More »Spring Boot Hello World

Spring Tool Suite: Failed to load the JNI shared library

Este tutorial irá mostrar como resolver o erro “Failed to load the JNI shared library” durante a inicialização do Spring Tool Suite.

spring tool suite failed to load the jni shared library error

O erro “Failed to load the JNI shared library” geralmente é causado por dois motivos:

  1. O tipo de arquitetura (32 ou 64 bits) entre seu Java e seu Spring Tool Suite são incompatíveis;
  2. Seu STS.ini está apontando para o diretório home do Java ao invés de apontar para o executável do Java.

Vamos explorar a solução para os dois casos:

Read More »Spring Tool Suite: Failed to load the JNI shared library

Spring Tool Suite: Failed to load the JNI shared library

This tutorial will show you how to solve the Spring Tool Suite “Failed to load the JNI shared library” initialisation error.

spring tool suite failed to load the jni shared library error

The “Failed to load the JNI shared library” error is generally caused by two reasons:

  1. The architecture version (32 or 64 bits) of your Java and your Spring Tool Suite don’t match;
  2. Your STS.ini is pointing to your Java home directory instead of the Java executable.

Let’s explore the solutions for both cases.

Read More »Spring Tool Suite: Failed to load the JNI shared library

Instalar o Spring Tool Suite no Eclipse

Spring logo


Este tutorial irá mostrar como instalar o Sprint Tool Suite no Eclipse e também como baixar e executar a versão stand-alone da suíte.

O Sprint Tool Suite (STS) é um toolbox baseado no Eclipse para desenvolvimento com Spring, que contém funcionalidades como o Boot Dashboard, suporte a todo o ecossistema do Spring e integração nativa com Maven, Gradle and Git.

Pré-requisitos

Read More »Instalar o Spring Tool Suite no Eclipse

Install Spring Tool Suite on Eclipse

Spring logo


This tutorial will show how to install Spring Tool Suite on Eclipse and also the option to download and run the stand-alone version of the suite.

The Spring Tool Suite (STS) is an Eclipse based toolbox for Spring development, containing features such as a Boot Dashboard, support to the whole Spring ecosystem and native integration with Maven, Gradle and Git.

Pre-requisites

Read More »Install Spring Tool Suite on Eclipse

EJB: Application Exception vs System Exception

Existem dois tipos de exceções em EJB: application exception e system exception. Este guia irá mostrar como identificar e implementar ambos os tipos.

Porque dois tipos de exceções em EJB?

No EJB, é importante saber quando uma exceção ocorreu devido a um problema de negócio ou um erro de sistema. Deste modo, exceções EJB são dividas em dois tipos para representar problemas de negócios possivelmente recuperáveis (como uma checked exception em Java) ou um erro inesperado e irrecuperável causado por um erro de sistema ou erros de código (como uma runtime exception).

Mesmo depois de todos os conceitos envolvidos, elas são apenas exceções comuns contendo metadados úteis para o container definidos por anotações ou XML no deployment descriptor, para dizer ao container EJB como tratá-las.

Read More »EJB: Application Exception vs System Exception

EJB: Application Exception vs System Exception

There are two types of exceptions in EJB: application exception and system exception. This guide will show how to identify and implement both of them.

Why two types of exceptions in EJB?

In EJB, it’s important to know whether an exception has occurred because of a business problem or a system error. That way, EJB exceptions are split in two to represent a maybe recoverable business problem (like an ordinary checked exception in Java) or a unexpected and unrecoverable issue caused by a system error or bad coding (like common runtime exceptions).

After all the concepts involved, they are just ordinary exceptions with meaningful metadata defined by annotations or XML configuration in the deployment descriptor to tell the EJB container how to deal with them.

Read More »EJB: Application Exception vs System Exception