java:best-practice
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
java:best-practice [2021/08/11 10:56] – external edit 127.0.0.1 | java:best-practice [2022/06/21 10:29] (current) – [用构造函数代码@Autowired] morgan0329 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== BigDecimal转String ====== | ||
+ | 不要使用 toString()方法,会转成科学计数法的形式。 要用 toPlainString() | ||
+ | |||
+ | ====== 关于swaggerAPI地址规范 ====== | ||
+ | < | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | 然后比如: /web/user (第二层表示 模块名) | ||
+ | |||
+ | / | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ====== 用构造函数代码@Autowired ====== | ||
+ | <code java> | ||
+ | // | ||
+ | @Autowired | ||
+ | private Environment env; | ||
+ | | ||
+ | // | ||
+ | private final Environment env; | ||
+ | public UserController(Environment env) { | ||
+ | this.env = env; | ||
+ | } | ||
+ | // | ||
+ | @RequiredArgsConstructor | ||
+ | public class UserController { | ||
+ | private final Environment env; | ||
+ | } | ||
+ | </ | ||
+ | F.Y.I.: https:// |