Spring Webflux: How to create a Tomcat WAR for deployment? - spring-boot

I've seen and tryed a lot of tutorial about spring-boot-starter-tomcat. But those worked for spring boot JPA but no for webflux.
Could you help me with that please?

Spring Boot does not support deploying a WebFlux application as a war file. If you want to use WebFlux, you should use jar packaging with an embedded container and launch your app using java -jar.

You can go through below link to understand the choices
webflux-server-choice
Can you please try this see that works?
compile('org.springframework.boot:spring-boot-starter-webflux') {
exclude group: 'org.springframework.boot',
module: 'spring-boot-starter-reactor-netty'
}
compile('org.springframework.boot:spring-boot-starter-tomcat')
This is what I found in this link
Learning Spring Boot 2.0 - Second Edition
Note: I am not sure about this is the right thing to do as I am not sure about the NIO capabilities of tomcat.

Related

Do we really need to add spring boot starter web for spring boot admin clients?

Version 1.5.4 was working fine without extra declaration of starter web in POM of Spring Boot Admin Clients. When I upgraded to 2.0.1, I had to add starter web to POM to make it work. Without starter web in client apps, there is no error or no log related to registering the application.
It's not documented anywhere as far as I know. Can anyone please confirm?
Spring Boot Admin 2.x can run on netty and on tomcat. So if you want to run on tomcat you have to explicitly import the spring-boot-starter-web.
The getting started guide contains this dependency http://codecentric.github.io/spring-boot-admin/current/#set-up-admin-server

Logback Appender for Webpage in Spring Boot application

I have a maven and spring boot application which use logback.
This application is on some servers and the log files on this servers are stored only on this server.
Give it a tool/api which is free, can visualize the logs into a webpage and is easy to integrat with spring boot and maven?
I have try JAMon but it will not work with Spring boot (need to deploy a war file) because the spring boot application is a embedded application. Thanks for Help :)
Have a look on Kibana, search for ELK-Stack. You can easily run it using Docker. There is also a Maven lib for the logstash-forwarder.

Spring Boot 1.2.4.RELEASE cannot generate a simple Startup Project

I am using Spring Boot version 1.2.4.RELEASE to generate a simple web project. The full Url for creating this project is:
http://start.spring.io/starter.zip?name=demo3&groupId=org.test&artifactId=demo3&version=0.0.1-SNAPSHOT&description=Demo+project+for+Spring+Boot&packageName=demo3&type=maven-project&packaging=jar&javaVersion=1.7&language=java&bootVersion=1.2.4.RELEASE&dependencies=web
The download starter project opened in the STS 3.6.4.RELEASE with tons of errors: Missing artifact, ArtifactDescriptorException from the pom.xml file.
However, if I use version 1.1.12.RELEASE of the Spring Boot, I have no problem to create the startup project.
Is this a bug in the 1.2.4.RELEASE of the Spring Boot? I doubt it.
The project is OK.
Please to check your local env, specially connexion, maven configuration (setting.xml), ...etc
Good luck

How to add email to Spring Boot gradle build

Spring boot has a number of starter dependencies. The default set does not include support for mail (org.springframework.mail is missing in Boot). How do I configure my build.gradle to include the spring framework mail support?
For spring boot you want to use this:
compile("org.springframework.boot:spring-boot-starter-mail")
See more about spring starters here
Try spring-context-support, ie
compile 'org.springframework:spring-context-support'
You might find this a helpful tool for that kind of query: http://www.findjar.com.

Can Spring Boot + Gradle generate a war file compatible with Servlet 2.4?

I've been reading about using Spring Boot and Gradle to quickly build RESTful services: https://spring.io/guides/gs/rest-service/. I'd like to give it a try but I need to build a war that's compatible with servlet 2.4 (I know.. life in the 1970's).
The error I get when attempting to deploy the war generated by following the guide above to Sun App Server 8.1 is:
Unknown deployable object type specified: "Cannot determine the J2EE
component type"
The generated war has no web.xml and there may be other expected artifacts.
Configuring a spring-boot application using web.xml seems to suggest that a web.xml can be packaged with a Spring Boot application but doesn't explain how.
Is Spring Boot compatible with older servlet specs? How can Spring Boot and Gradle be used to generate a war that works on older web containers?
Thanks.
The answer to the question you linked to didn't actually go as far as saying that you could easily create a fully-leaded Boot application with Servlet 2.4. I consider that quite a hard, but probably achievable, target if you are prepared to do some legwork, and accept some compromises. You might find this stuff useful: https://github.com/scratches/spring-boot-legacy (I managed to use it to push an app to GAE). But there are some limits to what can be supported for such old technology, and we aren't officially supporting anything other than Servlet 3.0.1 right now.

Resources