spring boot server stops after main method execution - spring-boot

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.3.RELEASE)
(application stops after main class execution.)

Related

Cannot set application properties via mvn release plugin

In CI part most of the times I prefer standard maven phases to execute build steps. In these cases I override application.properties e.g.: -Dlogging.level.root=OFF -Dspring.main.banner-mode=off to turn off debugging logs and save some precious build time.
In some pipelines I prefer to use maven release plugin and I noticed that these flags does not work there.
e.g.: mvn release:prepare -Dspring.main.banner-mode=off
[INFO]
[INFO] . ____ _ __ _ _
[INFO] /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
[INFO] ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] \\/ ___)| |_)| | | | | || (_| | ) ) ) )
[INFO] ' |____| .__|_| |_|_| |_\__, | / / / /
[INFO] =========|_|==============|___/=/_/_/_/
[INFO] :: Spring Boot :: (v2.1.4.RELEASE)
[INFO]
Still display spring banner
Any suggestion?

Under what conditions is app.setBannerMode(Banner.Mode.OFF); ignored?

I am calling app.setBannerMode(Banner.Mode.OFF); in my application but I still get a banner.
My code:
SpringApplication app = new SpringApplication(MyApp.class);
app.setBannerMode(Banner.Mode.OFF);
app.setAdditionalProfiles("foobar");
Output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.8.RELEASE)
Expected output:
(nothing)
What could be causing this?!

How can I change serenity-bdd log settings in maven

Were using serenity-bdd, and log analysis is important. But there is a lot of spam in the logging:
Serenety uses a lot of asci art in there logging witch is in my case waste of space and giving a lot of noice:
end2endtests | _____ _____ ____ _____ ____ _____ _ ____ _____ _____ ____
end2endtests | |_ _| ____/ ___|_ _| / ___|_ _|/ \ | _ \_ _| ____| _ \
end2endtests | | | | _| \___ \ | | \___ \ | | / _ \ | |_) || | | _| | | | |
end2endtests | | | | |___ ___) || | ___) || |/ ___ \| _ < | | | |___| |_| |
end2endtests | |_| |_____|____/ |_| |____/ |_/_/ \_\_| \_\|_| |_____|____/
end2endtests |
end2endtests |
And then on the end we get:
end2endtests | __ _____ _____ ____ _____ ____ _ ____ ____ _____ ____
end2endtests | _ \ \ |_ _| ____/ ___|_ _| | _ \ / \ / ___|/ ___|| ____| _ \
end2endtests | (_)_____| | | | | _| \___ \ | | | |_) / _ \ \___ \\___ \| _| | | | |
end2endtests | _|_____| | | | | |___ ___) || | | __/ ___ \ ___) |___) | |___| |_| |
end2endtests | (_) | | |_| |_____|____/ |_| |_| /_/ \_\____/|____/|_____|____/
end2endtests | /_/
end2endtests |
end2endtests | TEST PASSED
We do this in our Jenkins server trough a Maven command, I realy would like to reduce this noice so we have a bit less logging and sutch. I been googeling for it but havent found a clear cut answer that gave me the insight.
You need to pass -Dserenity.console.headings=minimal or -Dserenity.console.headings=normal in command line.
Or use
System.SetProperty("serenity.console.headings", "normal");
See below for more details
http://thucydides.info/docs/serenity-staging/
You can use below properties in serenity.properties file to turn off logging in reporting. (Serenity model/core version: 2.2.5)
serenity.console.headings=none to turn off the TEST STARTED banner and serenity.console.banner=none to turn off the SERENITY BDD banner.
Reference:
https://www.javadoc.io/doc/net.serenity-bdd/serenity-model/latest/net/thucydides/core/ThucydidesSystemProperty.html

Initialize gem Artii on a File (Ruby)

I know that I can initialize artii on the cmd with:
artii "word"
And WORD appears, but I cant find how to do this directly from a .rb file.
Artii::Base#asciify returns a formatted string:
require 'artii'
a = Artii::Base.new
a.asciify('word')
#=> " _ \n | |\n __ _____ _ __ __| |\n \\ \\ /\\ / / _ \\| '__/ _` |\n \\ V V / (_) | | | (_| |\n \\_/\\_/ \\___/|_| \\__,_|\n \n "
You have to print it in order to see the formatting:
puts a.asciify('word')
Output:
_
| |
__ _____ _ __ __| |
\ \ /\ / / _ \| '__/ _` |
\ V V / (_) | | | (_| |
\_/\_/ \___/|_| \__,_|

When I use Spring Boot to start a remote service interface I get a "missing EmbeddedServletContainerFactory bean" exception

Following is my entire stacktrace in intellijIDEA:
"C:\Program Files\Java\jdk1.6.0_29\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:57558,suspend=y,server=n -javaagent:C:\Users\clearity\.IntelliJIdea13\system\groovyHotSwap\gragent.jar -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.6.0_29\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\sunjce_provider.jar;D:\Work_space\External Card Related\project_related\icpay_v3_merchant\out\production\icpay_v3_merchant;C:\Users\clearity\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.1.6\165b8246372a829c1915611646f6d964010656cf\groovy-all-2.1.6.jar;D:\Work_space\Spring-boot\annotations-api.jar;D:\Work_space\Spring-boot\catalina.jar;D:\Work_space\Spring-boot\commons-codec-1.6.jar;D:\Work_space\Spring-boot\commons-logging-1.1.3.jar;D:\Work_space\Spring-boot\ecj-4.3.1.jar;D:\Work_space\Spring-boot\el-api.jar;D:\Work_space\Spring-boot\fluent-hc-4.3.4.jar;D:\Work_space\Spring-boot\httpclient-4.3.4.jar;D:\Work_space\Spring-boot\httpclient-cache-4.3.4.jar;D:\Work_space\Spring-boot\httpcore-4.3.2.jar;D:\Work_space\Spring-boot\httpmime-4.3.4.jar;D:\Work_space\Spring-boot\jasper-el.jar;D:\Work_space\Spring-boot\jasper.jar;D:\Work_space\Spring-boot\jsp-api.jar;D:\Work_space\Spring-boot\juli-6.0.41.jar;D:\Work_space\Spring-boot\servletapi-3.0.jar;D:\Work_space\Spring-boot\spring-aop-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-beans-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-1.1.1.RELEASE-tests.jar;D:\Work_space\Spring-boot\spring-boot-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-actuator-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-autoconfigure-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-gradle-plugin-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-context-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-context-support-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-core-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-expression-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-web-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-webmvc-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\tomcat-coyote.jar;D:\Work_space\Spring-boot\tomcat-dbcp.jar;D:\Work_space\Spring-boot\tomcat-util-7.0.16.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\commons-codec-1.6.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\commons-logging-1.1.3.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\fluent-hc-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpclient-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpclient-cache-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpcore-4.3.2.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpmime-4.3.4.jar;C:\Download\UsefulJars\fastjson-1.1.39.jar;C:\Download\jpos-1.9.0.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-log4j12-1.7.7.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-nop-1.7.7.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-api-1.7.7.jar;C:\Download\UsefulJars\druid-1.0.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\lib\idea_rt.jar" MerchantApplication
Connected to the target VM, address: '127.0.0.1:57558', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.1.RELEASE)
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:683)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:944)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:933)
at org.springframework.boot.SpringApplication$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at MerchantApplication.main(MerchantApplication.groovy:17)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:185)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
... 11 more
Disconnected from the target VM, address: '127.0.0.1:57558', transport: 'socket'
Process finished with exit code 1
help me
you can add
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

Resources