随笔分类 -  springboot

摘要:1:修改pom.xml 将“jar”改为“war” <packaging>war</packaging> 将: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</ 阅读全文
posted @ 2020-12-08 17:35 dcrenl 阅读(192) 评论(0) 推荐(0) 编辑
摘要:一:使用@CrossOrigin注解 @CrossOrigin @RequestMapping(value = "/get") public HashMap<String, Object> get(@RequestParam String name) { HashMap<String, Object 阅读全文
posted @ 2020-12-08 17:22 dcrenl 阅读(139) 评论(0) 推荐(0) 编辑
摘要:import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springfra 阅读全文
posted @ 2020-12-08 17:06 dcrenl 阅读(153) 评论(0) 推荐(0) 编辑
摘要:package com.geotmt.billingcenter.common.utils; import org.datanucleus.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; impor 阅读全文
posted @ 2020-11-26 14:02 dcrenl 阅读(2659) 评论(0) 推荐(0) 编辑
摘要:@autowired 注入dao层的时候,标红报错,但不影响编译使用 按照严格的spring注解方式在dao层加入@Repository注解 阅读全文
posted @ 2020-11-12 13:27 dcrenl 阅读(1220) 评论(0) 推荐(0) 编辑
摘要:@Resource @Resource有两个常用属性name、type,所以分4种情况 指定name和type:通过name找到唯一的bean,找不到抛出异常;如果type和字段类型不一致,也会抛出异常 指定name:通过name找到唯一的bean,找不到抛出异常 指定type:通过tpye找到唯一 阅读全文
posted @ 2020-11-12 13:23 dcrenl 阅读(1470) 评论(0) 推荐(1) 编辑
摘要:通过静态方法获取,你也可以封装一个静态方法出来 @GetMapping(value = "") public String center() { ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes 阅读全文
posted @ 2020-11-10 13:57 dcrenl 阅读(3283) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示