1

I have springboot application than will be deployed to the tomcat. I have class:

public class SpringBootApp    extends SpringBootServletInitializer  {
....
}

In the application.properties I have:

server.contextPath=/

But when app going deployed to the tomcat, it not unavailable with url like: http://193.123.33.33:8080/ Buy available with url http://193.123.33.33:8080/appname

How I will setting up springboot for root url mapping in the tomcat? Thanks!

denisaaa08
  • 171
  • 1
  • 2
  • 11
  • Possible duplicate of [Add context path to Spring Boot application](https://stackoverflow.com/questions/20405474/add-context-path-to-spring-boot-application) – Juan Carlos Mendoza Dec 29 '17 at 13:06
  • This is your Tomcat that you need to set up to redirect on your base url, and not your spring boot app. Your app is appname, and you can't go above it. So you need to point all the incoming calls on the URL http://193.123.33.33:8080/ to the URL http://193.123.33.33:8080/appname – DamCx Dec 29 '17 at 13:07
  • @JuanCarlosMendoza Martin exactly looking to do the opposite – DamCx Dec 29 '17 at 13:08
  • @JuanCarlosMendoza I need analog like web.xml: test / Do spring boot any setting like this? I don't know:( – denisaaa08 Dec 29 '17 at 13:24
  • @JuanCarlosMendoza Path to DispatcherServlet of the SpringBoot. – denisaaa08 Dec 29 '17 at 13:28
  • @DamCx redirect is bad solution. I think.. – denisaaa08 Dec 29 '17 at 13:30
  • That is the only way, in fact. Unless you build an apache as a front to redirect on the right URL, but this may be too much for your need – DamCx Dec 29 '17 at 13:32
  • @DamCx Solution is create ROOT.war in the webapp tomcat folder. – denisaaa08 Dec 29 '17 at 14:15

2 Answers2

0

in configuration file ".yml" file need to declare

server: port: 8089 display-name: displayname

and for the domain name need to configure in tomcat properties. but for the local environment http:// will not work.

Anupam Biswas
  • 66
  • 1
  • 4
  • Do you have a sample of this yml file? – denisaaa08 Dec 29 '17 at 13:29
  • server: port: 2222 management: security: enabled: false mail: enabled: false smtp: host: port: fromAddress: fromName: success: recipients: failed: recipients: --- spring: profiles: logging: config: server: ssl: key-alias: key-password: key-store: key-store-provider: key-store-type: – Anupam Biswas Dec 29 '17 at 13:38
  • Format of .yml file is very important , if you miss any tab of space then it will not work. – Anupam Biswas Dec 29 '17 at 13:42
  • *.properties is analog *.yml files and i have this settings. Or your yml settings successfully appled and work in the tomcat with root url path? – denisaaa08 Dec 29 '17 at 14:07
  • I am not sure but what I have done, I am telling. For spring boot you dont need to keep tomcat explicitly. If you run it boot initialized the embedded tomcat , so I think we need to configure any setting within .properties or .yml file – Anupam Biswas Dec 29 '17 at 17:58
  • for name if your sever has a public IP or DNS server and your application port is 80 , then your application will be directly accessible from http:domainname.com – Anupam Biswas Dec 29 '17 at 18:00
0

Solution is create ROOT.war in the webapp tomcat folder.

denisaaa08
  • 171
  • 1
  • 2
  • 11