Common Backend Development Pitfalls and Their Solutions
The article outlines frequent backend development problems such as duplicate configuration files, hard‑coded parameters, mixed logging practices, insufficient code review, and Maven dependency issues, and provides practical solutions including unified Spring configuration, proper logging, and disciplined deployment processes.
The post begins with a promotional note inviting readers to claim a free "Programmer Book Collection" by navigating the backend menu and replying with "5000".
The author then shares a series of real‑world backend issues encountered at a recent company, starting with the confusion caused by loading two configuration files—one from WEB-INF and an external override—leading to inconsistent property handling. Example code shows setting a property: prop_c.setProperty(key, value); Next, many parameters are hard‑coded in the source, such as role checks: role.haveRole("ADMIN_USE") Logging is another pain point: developers mix System.out.println with proper logger calls, and exception handling often omits stack traces, making debugging difficult. The author recommends logging the full stack trace, e.g., e.getMessage(), and catching a generic Exception when only logging is needed.
Further problems include lack of technical manager review before code deployment, causing mismatches between production and development environments, especially with database schema or file template changes, and arbitrary modifications to production databases that rely solely on developer discipline.
A Maven dependency issue is described where a pom references another pom without providing a JAR. The suggested fix is to declare the dependency type explicitly: <type>pom</type> To address these challenges, the author proposes using Spring's application.xml or application.yml for unified configuration, avoiding external files in development, and specifying configuration locations at runtime for production, for example:
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=server/src/main/config/application.properties -jar xxx.jar &Emphasis is placed on adhering to coding standards, avoiding ad‑hoc changes, and adding configurations without modifying existing source code when possible.
The article concludes with another promotional reminder to scan a QR code to receive the free book management system source code.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
