简体   繁体   中英

Spring boot port conflicts with Jboss port?

I have a Spring boot app that runs inside a JBoss EAP 6.4.0 server with a JDK 1.7, and packaged in an EAR with maven.

  • In my spring boot application.properties (under src/main/resources), I have server.port=8081
  • And in my JBoss standalone.xml file, I have <socket-binding name="http" port="8080"/>

Then, when I run my app (from Eclipse with Run on server > My JBoss server ), It appears that the server is listening on 8080, ie server.port was ignored.

Also tried this:

@Component
public class CustomizationBean implements EmbeddedServletContainerCustomizer {
    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        container.setPort(8081);
    }
}

Simple log ensures that the method is well executed. But app still listening on 8080.

How can I get my app runing on 8081 please ? (Without changing my standalone.xml file)

I've already read the doc but that didn't help me: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-change-the-http-port

I am very new to Java.

Thanks.

server.port is only used by spring boot when you do a fat-jar packaging and use the embedded servlet container. So if you don't change your deployment model, you simply can't without changing your standalone.xml

you could install the STS and do a run as -> spring boot app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM