Spring boot application stops after starting.
I've generated project with https://start.spring.io , but this happens, when i'm following instructions from https://spring.io/quickstart
> Task :bootRun
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.4)
2022-03-18 22:29:09.667 INFO 14205 --- [ main] com.hidk.HidPigeon.HidPigeonApplication : Starting HidPigeonApplication using Java 17.0.2 on ABOBUS.lan with PID 14205 (/Users/laptevaleksander/Library/Mobile Documents/com~apple~CloudDocs/Documents/Projects/HidPigeon/build/classes/java/main started by laptevaleksander in /Users/laptevaleksander/Library/Mobile Documents/com~apple~CloudDocs/Documents/Projects/HidPigeon)
2022-03-18 22:29:09.669 INFO 14205 --- [ main] com.hidk.HidPigeon.HidPigeonApplication : No active profile set, falling back to 1 default profile: "default"
2022-03-18 22:29:10.250 INFO 14205 --- [ main] com.hidk.HidPigeon.HidPigeonApplication : Started HidPigeonApplication in 1.018 seconds (JVM running for 1.373)
The solution was to add this into build.gradle:
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.4.3.RELEASE'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime'
Your application is started successfully, there is no errors, the log indicate that :
main] com.hidk.HidPigeon.HidPigeonApplication : Started HidPigeonApplication in 1.018 seconds (JVM running for 1.373)
Edit : you can add the spring-boot-starter-web as below and you project will start as expected:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
result :
you can test access to the server from this url: http://localhost:8080/
Related
I'm trying to restart the application by using RestartEndpoint, but it loops restart with Spring version 2.6.4 and java 11.
Any solutions for this problem?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>3.1.1</version>
</dependency>
#Component
public class TestRestartApplication {
#Autowired
private RestartEndpoint restartEndpoint;
public void restartApp() {
restartEndpoint.restart();
}
}
application.properties:
management.endpoint.restart.enabled=true
management.endpoints.web.exposure.include=restart,health
Console logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.4)
2022-03-16 20:53:29.904 INFO 1828 --- [ Thread-6] com.rean.ReloadSpringApplication : Starting ReloadSpringApplication using Java 11.0.2 on MSI with PID 1828 (D:\Rean Java\reload-spring-application\target\classes started by dawnt in D:\Rean Java\reload-spring-application)
2022-03-16 20:53:29.904 INFO 1828 --- [ Thread-6] com.rean.ReloadSpringApplication : No active profile set, falling back to 1 default profile: "default"
2022-03-16 20:53:30.030 INFO 1828 --- [ Thread-6] o.s.cloud.context.scope.GenericScope : BeanFactory id=abc9c58b-bafa-3329-a3c8-8f791cae2962
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.4)
2022-03-16 20:53:29.904 INFO 1828 --- [ Thread-6] com.rean.ReloadSpringApplication : Starting ReloadSpringApplication using Java 11.0.2 on MSI with PID 1828 (D:\Rean Java\reload-spring-application\target\classes started by dawnt in D:\Rean Java\reload-spring-application)
2022-03-16 20:53:29.904 INFO 1828 --- [ Thread-6] com.rean.ReloadSpringApplication : No active profile set, falling back to 1 default profile: "default"
2022-03-16 20:53:30.030 INFO 1828 --- [ Thread-6] o.s.cloud.context.scope.GenericScope : BeanFactory id=abc9c58b-bafa-3329-a3c8-8f791cae2962
I have one spring-boot test application in which I provide the following configuration in application.yml file. when I start my server using mvn test, it doesn't initiate the database connection, what can be the issue here? Am I missing any dependency in pom.xml?
spring.datasource.driverClassName = com.ibm.db2.jcc.DB2Driver
spring.datasource.url=jdbc:db2://<fullURL>
spring.datasource.username = <uname>
spring.datasource.password = <password>
Following are my dependencies related to spring-boot
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
Here are my boot logs in which I don't see the database connection logs
[INFO] Running com.test.installments.customers.data.processor.test.RunTest
11:11:30.823 [main] INFO o.s.b.t.c.SpringBootTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [com.test.in
stallments.customers.data.processor.test.RunTest], using SpringBootContextLoader
11:11:30.829 [main] INFO o.s.t.c.s.AbstractContextLoader - Could not detect default resource locations for test class [com.test.installments.customers.data.
processor.test.RunTest]: no resource found for suffixes {-context.xml, Context.groovy}.
11:11:30.976 [main] INFO o.s.b.t.c.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.springfr
amework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecut
ionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.we
b.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframe
work.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.te
st.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.tes
t.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.co
ntext.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
11:11:30.992 [main] INFO o.s.b.t.c.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBefor
eModesTestExecutionListener#162be91c, org.springframework.test.context.event.ApplicationEventsTestExecutionListener#2488b073, org.springframework.boot.test.mock.mo
ckito.MockitoTestExecutionListener#1c9f0a20, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener#55787112, org.springfra
mework.test.context.support.DirtiesContextTestExecutionListener#1cd201a8, org.springframework.test.context.transaction.TransactionalTestExecutionListener#7db82169,
org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener#1992eaf4, org.springframework.test.context.event.EventPublishingTestExecutionListener#f74e83
5, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener#3276732, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionLi
stener#3f28bd56, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener#31e3250d, org.springframework.boot.test.aut
oconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener#19fe4644, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListe
ner#21d8bcbe, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener#5be067de]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.3)
11:11:31.362 [main] INFO c.m.i.c.data.processor.test.RunTest - Starting RunTest using Java 11.0.8 on test with PID 17676 (started by test in C:\git\c
ustomers-data-processor-tests)
11:11:31.362 [main] INFO c.m.i.c.data.processor.test.RunTest - The following profiles are active: dev
11:11:31.446 [main] INFO c.m.i.c.data.processor.test.RunTest - Started RunTest in 0.422 seconds (JVM running for 1.403)
-----------Databse driver name---------- com.ibm.db2.jcc.DB2Driver
11:11:32.161 [main] DEBUG com.intuit.karate.Suite - [config] classpath:karate-config.js
11:11:32.858 [main] INFO com.intuit.karate - karate.env system property was: null
11:11:32.932 [main] INFO com.intuit.karate - [print] Total number of rows
---------------------------------------------------------
feature: classpath:com/test/installments/customers/data/processor/test/fileuload/uploadfile.feature
Couple of things I note:
You are mentioning application.yml but the format of the file is properties
You need to add the Driver in your dependencies for Spring Boot to pick up as well.
If you are running test, and have an applicatio.yml in src/test/resources, it will override the one in src/main/resources
I am trying to run my spring boot application using the docker-compose file but the service running inside the docker container is not able to connect to the database container.
Below is the exception stack trace from docker-compose logs
couchbase-demo | Starting Couchbase Server -- Web UI available at http://<ip>:8091
couchbase-demo | and logs available in /opt/couchbase/var/lib/couchbase/logs
couchbase-demo |
tech-blog | LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy#589446616
tech-blog |
tech-blog | . ____ _ __ _ _
tech-blog | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
tech-blog | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
tech-blog | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
tech-blog | ' |____| .__|_| |_|_| |_\__, | / / / /
tech-blog | =========|_|==============|___/=/_/_/_/
tech-blog | :: Spring Boot :: (v2.2.4.RELEASE)
tech-blog |
tech-blog | 01:33:40.468 [main] INFO com.tech.blog.TechBlogApplication - Starting TechBlogApplication v0.0.2-SNAPSHOT on bf6509f5200d with PID 1 (/opt/tech/techblog.jar started by root in /opt/tech)
tech-blog | 01:33:40.477 [main] DEBUG com.tech.blog.TechBlogApplication - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
tech-blog | 01:33:40.477 [main] INFO com.tech.blog.TechBlogApplication - No active profile set, falling back to default profiles: default
^CGracefully stopping... (press Ctrl+C again to force)
Stopping tech-blog ... done
Stopping couchbase-demo ... done
srinathkavuri#Srinaths-MBP TechBlog % docker logs couchbase-demo
Starting Couchbase Server -- Web UI available at http://<ip>:8091
and logs available in /opt/couchbase/var/lib/couchbase/logs
Waiting for Couchbase Server to start....% srinathkavuri#Srinaths-MBP TechBlog % docker-compose up
Starting couchbase-demo ... done
Starting tech-blog ... done
Attaching to couchbase-demo, tech-blog
couchbase-demo | Starting Couchbase Server -- Web UI available at http://<ip>:8091
couchbase-demo | and logs available in /opt/couchbase/var/lib/couchbase/logs
tech-blog | LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy#1908923184
tech-blog |
tech-blog | . ____ _ __ _ _
tech-blog | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
tech-blog | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
tech-blog | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
tech-blog | ' |____| .__|_| |_|_| |_\__, | / / / /
tech-blog | =========|_|==============|___/=/_/_/_/
tech-blog | :: Spring Boot :: (v2.2.4.RELEASE)
tech-blog |
couchbase-demo |
tech-blog | 02:07:25.243 [main] INFO com.tech.blog.TechBlogApplication - Starting TechBlogApplication v0.0.2-SNAPSHOT on bf6509f5200d with PID 1 (/opt/tech/techblog.jar started by root in /opt/tech)
tech-blog | 02:07:25.250 [main] DEBUG com.tech.blog.TechBlogApplication - Running with Spring Boot v2.2.4.RELEASE, Spring v5.2.3.RELEASE
tech-blog | 02:07:25.251 [main] INFO com.tech.blog.TechBlogApplication - No active profile set, falling back to default profiles: default
tech-blog | 02:07:28.543 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
tech-blog | 02:07:28.544 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.30]
tech-blog | 02:07:28.683 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
tech-blog | 02:07:29.984 [cb-events] INFO com.couchbase.core - [com.couchbase.core][DnsSrvLookupFailedEvent][30ms] DNS SRV lookup failed (name not found), trying to bootstrap from given hostname directly.
tech-blog | 02:07:30.795 [cb-events] INFO com.couchbase.core - [com.couchbase.core][CoreCreatedEvent] {"clientVersion":"3.0.3","clientGitHash":"e55f7d43","coreVersion":"2.0.4","coreGitHash":"e55f7d43","userAgent":"couchbase-java/3.0.3 (Linux 4.19.76-linuxkit amd64; OpenJDK 64-Bit Server VM 1.8.0_121-b13)","maxNumRequestsInRetry":32768,"ioEnvironment":{"nativeIoEnabled":true,"eventLoopThreadCount":2,"eventLoopGroups":["EpollEventLoopGroup"]},"ioConfig":{"captureTraffic":[],"mutationTokensEnabled":true,"networkResolution":"auto","dnsSrvEnabled":true,"tcpKeepAlivesEnabled":true,"tcpKeepAliveTimeMs":60000,"configPollIntervalMs":2500,"kvCircuitBreakerConfig":"disabled","queryCircuitBreakerConfig":"disabled","viewCircuitBreakerConfig":"disabled","searchCircuitBreakerConfig":"disabled","analyticsCircuitBreakerConfig":"disabled","managerCircuitBreakerConfig":"disabled","numKvConnections":1,"maxHttpConnections":12,"idleHttpConnectionTimeoutMs":30000,"configIdleRedialTimeoutMs":300000},"compressionConfig":{"enabled":true,"minRatio":0.83,"minSize":32},"securityConfig":{"tlsEnabled":false,"nativeTlsEnabled":true,"hasTrustCertificates":false,"trustManagerFactory":null},"timeoutConfig":{"kvMs":10000000,"kvDurableMs":10000,"managementMs":75000,"queryMs":75000,"viewMs":75000,"searchMs":75000,"analyticsMs":75000,"connectMs":10000000,"disconnectMs":10000},"loggerConfig":{"customLogger":null,"fallbackToConsole":false,"disableSlf4j":false,"loggerName":"CouchbaseLogger","diagnosticContextEnabled":false},"orphanReporterConfig":{"emitIntervalMs":10000,"sampleSize":10,"queueLength":1024},"retryStrategy":"BestEffortRetryStrategy","requestTracer":"OwnedSupplier"} {"coreId":"0xce88bae700000001"}
tech-blog | 02:07:30.806 [cb-events] INFO com.couchbase.node - [com.couchbase.node][NodeConnectedEvent] Node connected {"coreId":"0xce88bae700000001","managerPort":"8091","remote":"localhost"}
tech-blog | 02:07:30.829 [cb-events] WARN com.couchbase.endpoint - [com.couchbase.endpoint][EndpointConnectionFailedEvent][271ms] Connect attempt 1 failed because of AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:11210 {"circuitBreaker":"DISABLED","coreId":"0xce88bae700000001","remote":"localhost:11210","type":"KV"}
tech-blog | com.couchbase.client.core.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:11210
tech-blog | Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.unix.Socket.finishConnect(Socket.java:243)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:672)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:649)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:529)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:465)
tech-blog | at com.couchbase.client.core.deps.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
tech-blog | at com.couchbase.client.core.deps.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
tech-blog | at com.couchbase.client.core.deps.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
tech-blog | at com.couchbase.client.core.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
tech-blog | at java.lang.Thread.run(Thread.java:745)
Below is my docker-compose file.
services:
couchbase.lcl:
image: bentonam/couchbase-docker:latest
container_name: couchbase-demo
ports:
- "8091-8094:8091-8094"
- "11210:11210"
environment:
CLUSTER_USERNAME: Administrator
CLUSTER_PASSWORD: pass
CLUSTER_NAME: TECH_BLOG_CLUSTER
SERVICES: data,index,query,fts
CLUSTER_RAMSIZE: 500
BUCKET: user-profile
BUCKET_RAMSIZE: 300
NODE_INIT_INDEX_PATH: /opt/couchbase/var/lib/couchbase/indexes
networks:
- tech-blog-network
techblog.lcl:
image: docker-tech-blog:latest
restart: always
container_name: tech-blog
links:
- couchbase.lcl
environment:
COUCHBASE_HOST: couchbase.lcl
depends_on:
- couchbase.lcl
ports:
- "8123:8123"
networks:
- tech-blog-network
networks:
tech-blog-network:
driver: bridge
Can anyone please let me know is there any issue with my docker-compose file?
Below is my spring configuration file
server:
port: 8123
logging:
level:
org.springframework: ERROR
com.tech.blog: DEBUG
pattern:
console: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
file: "%d %p %c{1.} [%t] %m%n"
file: /var/log/techblog.log
management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"
health:
defaults:
enabled: false
cb:
connectionTimeOut: 10000
kvTimeOut: 10000
hosts: localhost
cluster:
username: Administrator
password: pass
bucketname: user-profile
its not localhost when you are using docker container for each service.
change: hosts: localhost
to: hosts: couchbase.lcl
I'm writing test cases for service and util classes for my spring boot application. Following are snippets from the test cases
FooServiceImplTest.java
#RunWith(SpringRunner.class)
#SpringBootTest
public class FooServiceImplTest {
#Test
//test cases for FooServiceImplTest
}
BarUtilTest.java
#RunWith(SpringRunner.class)
#SpringBootTest
public class BarUtilTest {
#Test
//test cases for BarUtilTest
}
Now, when I run the test cases, I see something like the following in the console
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
17:21:07.835 [main] INFO c.c.l.s.impl.FooServiceImplTest - Starting FooServiceImplTest on Users-MacBook-Pro.local with PID 8944 (started by user in /Users/user/Documents/my-project)
17:21:07.836 [main] DEBUG c.c.l.s.impl.FooServiceImplTest - Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
17:21:07.836 [main] INFO c.c.l.s.impl.FooServiceImplTest - The following profiles are active: prod
17:21:10.828 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-2 - Starting...
17:21:10.890 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-2 - Start completed.
...
// runs test cases for FooServiceImplTest
17:21:33.643 [main] INFO c.c.l.s.impl.FooServiceImplTest - Started FooServiceImplTest in 40.898 seconds (JVM running for 102.231)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.0.RELEASE)
17:21:49.290 [main] INFO c.c.l.util.BarUtilTest - Starting BarUtilTest on Users-MacBook-Pro.local with PID 8944 (started by user in /Users/user/Documents/my-project)
17:21:49.290 [main] DEBUG c.c.l.util.BarUtilTest - Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
17:21:49.290 [main] INFO c.c.l.util.BarUtilTest - The following profiles are active: prod
17:21:50.809 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-3 - Starting...
17:21:50.972 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-3 - Start completed.
...
// runs test cases for BarUtilTest
17:22:04.765 [main] INFO c.c.l.util.BarUtilTest - Started BarUtilTest in 30.635 seconds (JVM running for 133.353)
So it looks like for every test suite I write, everything is initialized again. That may be one of the reasons that it is taking a lot of time to run the test cases as I add more test suites. Is there anyway to initialize everything once and run all test cases in one go?
I'm trying to provide some custom logging levels to the default logback configuration, but it seems my configuration file is being ignored. I though Boot may skip it for whatever reason but if I make the file not valid (remove / of self-closing tag for example) I got an exception about not being able to parse it - so it is being picked up.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Spring boot base -->
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="com.wedgetail" level="WARN" />
<logger name="nv" level="WARN" />
<logger name="StatsLogger" level="WARN" />
</configuration>
So for testing purposes (as my loggers are may be wrongly spelled or whatever) I included:
<logger name="org.springframework" level="ERROR" />
When the application comes up I still see spring logging on info level:
2014-08-22 14:28:34.756 WARN 5444 --- [on(3)-127.0.0.1] o.s.b.l.LoggingApplicationListener : Logging environment value '-Djava.util.logging.config.file="C:\Documents and Settings\zykajan\.IntelliJIdea13\system\tomcat\Unnamed_cnc-parent_2\conf\logging.properties"' cannot be opened and will be ignored
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.5.RELEASE)
2014-08-22 14:28:34.881 INFO 5444 --- [on(3)-127.0.0.1] o.s.boot.SpringApplication : Starting application on prgdwm395059 with PID 5444 (C:\workspace\command-and-control\webapp\target\cnc-webapp-UNVERSIONED-SNAPSHOT\WEB-INF\lib\spring-boot-1.1.5.RELEASE.jar started by zykajan in C:\Apps\Apache\jakarta\apache-tomcat-7.0.55\bin)
2014-08-22 14:28:34.928 INFO 5444 --- [on(3)-127.0.0.1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#5dd439: startup date [Fri Aug 22 14:28:34 CEST 2014]; root of context hierarchy
I wonder whether the first line should ring bells unfortunatelly it doesn't in my case :)
2014-08-22 14:28:34.756 WARN 5444 --- [on(3)-127.0.0.1] o.s.b.l.LoggingApplicationListener : Logging environment value '-Djava.util.logging.config.file="C:\Documents and Settings\zykajan\.IntelliJIdea13\system\tomcat\Unnamed_cnc-parent_2\conf\logging.properties"' cannot be opened and will be ignored
As usual, any tips much appreciated.
Upgrade to Spring Boot 1.1.6. for a fix of this issue.