Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
@Configuration
public class AppConfig {
@Bean
public MonBean monBean() {
return new MonBean();
}
}
@Component
public class MonComposant {
// ...
}
@Service
public class MonService {
// Logique métier
}
@Component
public class MonRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
System.out.println("Application démarrée !");
}
}
@Autowired
private MonService service;
@Service
public class MonService {
private final MonRepository repository;
@Autowired
public MonService(MonRepository repository) {
this.repository = repository;
}
}