
be.bagofwords.web.WebContainerConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bow-utils Show documentation
Show all versions of bow-utils Show documentation
Utility classes that are used in the count-db project and other bow-* projects
package be.bagofwords.web;
import be.bagofwords.application.MainClass;
import be.bagofwords.application.annotations.BowConfiguration;
import be.bagofwords.util.HashUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@BowConfiguration
public class WebContainerConfiguration {
@Bean
@Autowired
public WebContainer createWebContainer(MainClass mainClass) {
long hashCode = HashUtils.hashCode(mainClass.getClass().getSimpleName());
if (hashCode < 0) {
hashCode = -hashCode;
}
int randomPortForApplication = (int) (1023 + (hashCode % (65535 - 1023)));
return new WebContainer(randomPortForApplication);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy