Spring bean creation conditionally @ConditionalOn

I would like to create a Bean only when httpPort value not equals -1. I tried below code but It is complaining something wrong with the expression. Could you please fix this? or how to achieve my requirements.

I am using Java 8 and Spring Boot 1.5.4

I tried below options

@ConditionalOnExpression("'${httpPort}' ne '-1'")
@ConditionalOnExpression("'${httpPort}' != '-1'")
@ConditionalOnExpression("!'${httpPort == -1}'")
@ConditionalOnExpression("!${httpPort == -1}")

Most of the cases error is EL1041E: After parsing a valid expression,
there is still more data in the expression: ‘lcurly({)’

public class TomcatConfig {
    private int httpPort;

    @ConditionalOnExpression("'${httpPort}' ne '-1'")
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            public void customize(ConfigurableEmbeddedServletContainer container) {
                if (container instanceof TomcatEmbeddedServletContainerFactory) {
                    TomcatEmbeddedServletContainerFactory containerFactory =
                            (TomcatEmbeddedServletContainerFactory) container;

                    Connector connector = new Connector(TomcatEmbeddedServletContainerFactory.DEFAULT_PROTOCOL);

Solved this by @ConditionalOnProperty(“server.http.port”)

public EmbeddedServletContainerCustomizer containerCustomizer() {