Bonjour,

Je débute sur springboot, même si j'ai résolu le problème, j'aurai aimer savoir pourquoi ^^.

J'ai crée un projet simple, avec juste le spring-boot-starter, le test et spring-boot-maven-plugin.

Si je lance avec Spring boot app , aucun souci, j'arrive à contrôler mes logs dans la console grâce au fichier properties.

Si j'utilise un maven install, mon petite application marche toujours, mais j'ai beaucoup d'info sur la console et je n'arrive plus à les gérer avec le fichier properties.

Je vois qu'il y a un problème avec plusieurs jar identique de SLF4J avec Eclipse, mais je ne vois pas comment le gérer et pourquoi cela se produit.

Si quelqu'un peut m'éclaircir ?

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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/bbseb/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.18.0.20210618-2246/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Users/bbseb/eclipse/jee-2021-09/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/bbseb/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.18.0.20210618-2246/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Users/bbseb/eclipse/jee-2021-09/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.example:HelloWord1 >-----------------------
[INFO] Building HelloWord1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ HelloWord1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ HelloWord1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ HelloWord1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ HelloWord1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ HelloWord1 ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.demo.HelloWord1ApplicationTests
01:55:52.537 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
01:55:52.547 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
01:55:52.574 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.demo.HelloWord1ApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
01:55:52.581 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.demo.HelloWord1ApplicationTests], using SpringBootContextLoader
01:55:52.584 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.HelloWord1ApplicationTests]: class path resource [com/example/demo/HelloWord1ApplicationTests-context.xml] does not exist
01:55:52.584 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.HelloWord1ApplicationTests]: class path resource [com/example/demo/HelloWord1ApplicationTestsContext.groovy] does not exist
01:55:52.584 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.demo.HelloWord1ApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
01:55:52.584 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.demo.HelloWord1ApplicationTests]: HelloWord1ApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
01:55:52.614 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.demo.HelloWord1ApplicationTests]
01:55:52.654 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1\target\classes\com\example\demo\HelloWord1Application.class]
01:55:52.656 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.demo.HelloWord1Application for test class com.example.demo.HelloWord1ApplicationTests
01:55:52.730 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.demo.HelloWord1ApplicationTests]: using defaults.
01:55:52.731 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
01:55:52.738 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [javax/servlet/ServletContext]
01:55:52.740 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
01:55:52.741 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
01:55:52.744 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@753432a2, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@23bff419, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@4983159f, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@44e3a2b2, org.springframework.test.context.support.DirtiesContextTestExecutionListener@101639ae, org.springframework.test.context.event.EventPublishingTestExecutionListener@4c550889, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@1d2bd371, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@44040454, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@65fe9e33, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@18bc345, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@42f8285e, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@26bab2f1]
01:55:52.748 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@53142455 testClass = HelloWord1ApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@40dff0b7 testClass = HelloWord1ApplicationTests, locations = '{}', classes = '{class com.example.demo.HelloWord1Application}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@47c81abf, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@1f760b47, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@478db956, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e13529a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@93081b6, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@78b66d36], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with @DirtiesContext [false] with mode [null].
01:55:52.762 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@53142455 testClass = HelloWord1ApplicationTests, testInstance = com.example.demo.HelloWord1ApplicationTests@e84a8e1, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@40dff0b7 testClass = HelloWord1ApplicationTests, locations = '{}', classes = '{class com.example.demo.HelloWord1Application}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@47c81abf, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@1f760b47, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@478db956, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e13529a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@93081b6, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@78b66d36], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]].
01:55:52.787 [main] DEBUG org.springframework.boot.ApplicationEnvironment - Activating profiles []
01:55:52.788 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
 
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.2)
 
2021-12-31 01:55:52.989  INFO 16788 --- [           main] c.e.demo.HelloWord1ApplicationTests      : Starting HelloWord1ApplicationTests using Java 17 on SEB-Salon with PID 16788 (started by bbseb in D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1)
2021-12-31 01:55:52.990  INFO 16788 --- [           main] c.e.demo.HelloWord1ApplicationTests      : No active profile set, falling back to default profiles: default
2021-12-31 01:55:53.404  INFO 16788 --- [           main] c.e.demo.HelloWord1ApplicationTests      : Started HelloWord1ApplicationTests in 0.616 seconds (JVM running for 1.481)
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.28 s - in com.example.demo.HelloWord1ApplicationTests
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ HelloWord1 ---
[INFO] Building jar: D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1\target\HelloWord1-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.6.2:repackage (repackage) @ HelloWord1 ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ HelloWord1 ---
[INFO] Installing D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1\target\HelloWord1-0.0.1-SNAPSHOT.jar to C:\Users\bbseb\.m2\repository\com\example\HelloWord1\0.0.1-SNAPSHOT\HelloWord1-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\Users\bbseb\Mon Drive\Apprendre\Programmation\java\HelloWord1\pom.xml to C:\Users\bbseb\.m2\repository\com\example\HelloWord1\0.0.1-SNAPSHOT\HelloWord1-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.706 s
[INFO] Finished at: 2021-12-31T01:55:55+01:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.