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