Multiple Spring-boot applications running on one Tomcat

后端 未结 3 705
旧时难觅i
旧时难觅i 2020-12-15 01:13

Can I have two (or more) Spring-boot applications running on one Tomcat?

I have two applications packaged as war files and I would like to run them on o

相关标签:
3条回答
  • 2020-12-15 01:33

    As Spring Boot Reference says:

    If your application contains more than one Spring ApplicationContext you may find that names clash. To solve this problem you can set the endpoints.jmx.uniqueNames property to true so that MBean names are always unique.

    endpoints.jmx.domain=myapp
    endpoints.jmx.uniqueNames=true
    
    0 讨论(0)
  • 2020-12-15 01:33
    spring.jmx.default-domain=app-name
    spring.jmx.unique-names=true
    
    0 讨论(0)
  • 2020-12-15 01:46

    Similar to @Maciej answer. An alternative is to set the following

    spring.application.name=my-app-name
    spring.jmx.default-domain=my-app-name
    

    Or for application.yaml:

    spring:
      application:
        name: my-app-name
      jmx:
        default-domain: my-app-name
    

    Worked for me on Spring boot 1.5.9.RELEASE

    0 讨论(0)
提交回复
热议问题