DEV Community

Cover image for Dicas Rápidas: Como Ativar o Spring Boot DevTools no IntelliJ IDEA
Diego de Sousa Brandão
Diego de Sousa Brandão

Posted on

3 1 1

Dicas Rápidas: Como Ativar o Spring Boot DevTools no IntelliJ IDEA

O Spring Boot DevTools é uma ferramenta essencial para acelerar o desenvolvimento de aplicações Spring Boot, permitindo recarregamento automático da aplicação sempre que alterações no código são feitas. Neste guia rápido, vamos mostrar como ativá-lo corretamente no IntelliJ IDEA.

Passo 1: Adicionar a Dependência do DevTools

Para utilizar o DevTools, primeiro é necessário adicioná-lo ao projeto. Se você usa Maven, adicione a seguinte dependência no pom.xml:

Image description

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
Enter fullscreen mode Exit fullscreen mode

Se você utiliza Gradle, adicione a seguinte linha no build.gradle:

dependencies {
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
Enter fullscreen mode Exit fullscreen mode

Isso garantirá que o DevTools seja incluído apenas no ambiente de desenvolvimento.

Passo 2: Habilitar a Compilação Automática no IntelliJ IDEA

Para que o DevTools funcione corretamente, é necessário ativar a compilação automática no IntelliJ IDEA:

Abrir as configurações

Acesse File > Settings > Build, Execution, Deployment > Compiler.

Marque a opção "Build project automatically".

Image description

Permitir auto-make mesmo quando a aplicação está em execução:
Vá em File > Settings > Advanced Settings.

Image description

Marque a opção Allow auto-make to start even if developed application is currently running.

Não se esqueça de clicar em "Apply" e "Ok".

Por último, uma dica final: a mudança pode levar de meio segundo a dois segundos para ser refletida. Caso queira ver o resultado imediatamente, utilize o comando CTRL + F9.

Essas configurações permitirão que o IntelliJ compile automaticamente as alterações, acionando o reinício automático da aplicação pelo DevTools.

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of Stellar post

Discover what it takes to launch a Web3 startup

Bringing your Web3 idea to life and launching a startup can be a difficult, complicated process. Check out the Stellar Dev Diaries to learn from a team that is makiung it happen, in real time!

Learn more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay