📚 Cheatsheet

Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.

Snippets 5

Retour
Changer le port du serveur
Facile
# application.properties
server.port=8090
Classe principale d'une application
Facile
@SpringBootApplication
public class MonApplication {
    public static void main(String[] args) {
        SpringApplication.run(MonApplication.class, args);
    }
}
Définir le contexte de l'application
Facile
# application.properties
server.servlet.context-path=/api
Dépendance 'spring-boot-starter-web'
Facile
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Désactiver la bannière de démarrage
Intermédiaire
SpringApplication app = new SpringApplication(DemoApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);