Search code examples
javamavenspring-bootjboss6.x

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, i.e. 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.


Solution

  • 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