Bonjour j'ai une application Spring Boot
l'annotation @ApplicationScope ne fonctionne pas très bien. Voici ma classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 @Configuration public class ApplicationPropertiesConfig { @Bean @ApplicationScope @Qualifier("propertiesConfig") public PropertiesConfig getPropertiesConfig() throws NamingException { Context initCtx = new InitialContext(); --> JE METS UN POINT D'ARRET ICI Context envCtx = (Context) initCtx.lookup("java:comp/env"); String env = (String) envCtx.lookup("staffAccessEnvironment"); ........ ........ ........ return ......; } }
Quand je mets un point d'arrêt à la première ligne de la méthode getPropertiesConfig() et que je démare l'application, ça ne passe pas dans la méthode getPropertiesConfig()
Quand j'enlève l'annotation @ApplicationScope, au démarrage de l'application, ça passe dans cette méthode.
Visiblement, il existe un problème avec l'annotation @ApplicationScope. Si j'utilise l'annotation @Scope("application"), j'ai le même soucis. Comme vous l'avez deviné je veux créer un @Bean avec le scope application.
Pourquoi ça ne marche pas ?
Partager