You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

application properties配置8083端口后仍提示8080占用的解决方法

How to Get Your App to Start on Port 8083 Instead of 8080

Hey there, let's troubleshoot why your application is still clinging to port 8080 even though you've set server.port=8083 in your config file. Here are the most common fixes to get it up and running on your desired port:

  • Double-check your configuration file details
    First, make sure you're working with the right file and location:

    • Confirm the filename is application.properties (note the dot, not a space—typos here are way too common!).
    • Verify it’s placed directly in the src/main/resources directory (not nested in a subfolder, which would stop Spring from picking it up by default).
    • If you’re using Spring profiles (like dev/prod), check if an environment-specific config file (e.g., application-dev.properties) is overriding the main one—you’ll need to set server.port=8083 in the active profile’s file too.
  • Check for overriding startup parameters
    Command-line or IDE launch settings can easily override your config file:

    • If you’re starting the app via a JAR command, look for something like --server.port=8080 in the arguments. Remove that or swap it to --server.port=8083.
    • In your IDE (IntelliJ, Eclipse, etc.), open your Run/Debug configuration. Check the Program arguments or VM options sections for -Dserver.port=8080—update this to 8083 if it’s present.
  • Clean and rebuild your project
    Stale build artifacts or IDE caches can prevent config changes from taking effect:

    • For Maven projects, run mvn clean install in your terminal to wipe old builds and generate fresh ones.
    • For Gradle projects, use ./gradlew clean build.
    • Restart your IDE and clear its cache (e.g., in IntelliJ: File > Invalidate Caches... > Invalidate and Restart).
  • Ensure port 8083 isn’t occupied
    Even though the error mentions 8080, it’s worth confirming your target port is free:

    • Windows: Run netstat -ano | findstr :8083 to find the PID of the process using the port, then kill it with taskkill /F /PID <your-pid>.
    • Linux/Mac: Use lsof -i :8083 or netstat -tulpn | grep :8083 to locate the process, then terminate it with kill -9 <your-pid>.
  • Check for hardcoded ports in your code
    Sometimes developers hardcode ports in configuration classes or the main application file:

    • Search your codebase for instances of server.port or direct port assignments (e.g., in a @Configuration class). Make sure these are either removed or set to read from your application.properties file.

内容的提问来源于stack exchange,提问作者Trts

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 10:17:40