Java Code Examples for org.springframework.boot.autoconfigure.web.ServerProperties#getPort()

The following examples show how to use org.springframework.boot.autoconfigure.web.ServerProperties#getPort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: H2DbProperties.java    From tx-lcn with Apache License 2.0 6 votes vote down vote up
public H2DbProperties(
        @Autowired(required = false) ConfigurableEnvironment environment,
        @Autowired(required = false) ServerProperties serverProperties) {
    String applicationName = "application";
    Integer port = 0;
    if (Objects.nonNull(environment)) {
        applicationName = environment.getProperty("spring.application.name");
    }
    if (Objects.nonNull(serverProperties)) {
        port = serverProperties.getPort();
    }
    this.filePath = System.getProperty("user.dir") +
            File.separator +
            ".txlcn" +
            File.separator +
            (StringUtils.hasText(applicationName) ? applicationName : "application") +
            "-" + port;
}
 
Example 2
Source File: SampleController.java    From wingtips with Apache License 2.0 5 votes vote down vote up
@Autowired
public SampleController(ServerProperties serverProps, Environment environment) {
    this.serverPort = serverProps.getPort();
    String userIdHeaderKeysFromEnv = environment.getProperty("wingtips.user-id-header-keys");
    this.userIdHeaderKeys = (userIdHeaderKeysFromEnv == null)
                            ? null
                            : Arrays.asList(userIdHeaderKeysFromEnv.split(","));
}
 
Example 3
Source File: SampleController.java    From wingtips with Apache License 2.0 5 votes vote down vote up
@Autowired
public SampleController(ServerProperties serverProps, Environment environment) {
    this.serverPort = serverProps.getPort();
    String userIdHeaderKeysFromEnv = environment.getProperty("wingtips.user-id-header-keys");
    this.userIdHeaderKeys = (userIdHeaderKeysFromEnv == null)
                            ? null
                            : Arrays.asList(userIdHeaderKeysFromEnv.split(","));
}
 
Example 4
Source File: AuthorizationServerApp.java    From spring-security-oauth with MIT License 5 votes vote down vote up
@Bean
ApplicationListener<ApplicationReadyEvent> onApplicationReadyEventListener(ServerProperties serverProperties,
		KeycloakServerProperties keycloakServerProperties) {

	return (evt) -> {

		Integer port = serverProperties.getPort();
		String keycloakContextPath = keycloakServerProperties.getContextPath();

		LOG.info("Embedded Keycloak started: http://localhost:{}{} to use keycloak", port, keycloakContextPath);
	};
}
 
Example 5
Source File: JWTAuthorizationServerApp.java    From spring-security-oauth with MIT License 5 votes vote down vote up
@Bean
ApplicationListener<ApplicationReadyEvent> onApplicationReadyEventListener(ServerProperties serverProperties, KeycloakServerProperties keycloakServerProperties) {

    return (evt) -> {

        Integer port = serverProperties.getPort();
        String keycloakContextPath = keycloakServerProperties.getContextPath();

        LOG.info("Embedded Keycloak started: http://localhost:{}{} to use keycloak", port, keycloakContextPath);
    };
}
 
Example 6
Source File: AuthorizationServerApp.java    From spring-security-oauth with MIT License 5 votes vote down vote up
@Bean
ApplicationListener<ApplicationReadyEvent> onApplicationReadyEventListener(ServerProperties serverProperties,
		KeycloakServerProperties keycloakServerProperties) {

	return (evt) -> {

		Integer port = serverProperties.getPort();
		String keycloakContextPath = keycloakServerProperties.getContextPath();

		LOG.info("Embedded Keycloak started: http://localhost:{}{} to use keycloak", port, keycloakContextPath);
	};
}
 
Example 7
Source File: ApplicationInformation.java    From tx-lcn with Apache License 2.0 2 votes vote down vote up
/**
 * 模块HTTP端口号
 *
 * @param serverProperties serverProperties
 * @return int
 */
public static int serverPort(ServerProperties serverProperties) {
    return Objects.isNull(serverProperties) ? 0 : (Objects.isNull(serverProperties.getPort()) ? 8080 :
            serverProperties.getPort());
}