spring
sourny
sourny@126.com
展开
-
基于@Aspect的AOP配置
1、Spring除了支持Schema方式配置AOP,还支持注解方式:使用@Aspect来配置2、Spring默认不支持@Aspect风格的切面声明,通过如下配置开启@Aspect支持:Java代码 3、通过以上配置,Spring就能发现用@Aspect注解的切面内并把它应用到目标对象上。4、定义一个切面:Java代码转载 2015-04-27 10:26:18 · 852 阅读 · 0 评论 -
解决Spring MVC @ResponseBody返回中文字符串乱码问题
public static void responseJson(HttpServletResponse response,String data) throws IOException{ response.setContentType("text/json"); response.setCharacterEncoding("utf-8"); response.ge原创 2014-12-22 13:16:04 · 627 阅读 · 0 评论 -
用@PostConstruct 实现Service 类的静态静态成员的注入
@Autowired SqlDao sqdao;//自动注入 static SqlDao isqlDao;//静态成员变量@PostConstructpublic void init(){isqlDao = sqdao;//赋值}public static void test(){System.out.println(isqlDao);}原创 2015-04-27 10:32:14 · 2224 阅读 · 0 评论 -
使用spring @Scheduled注解执行定时任务
spring.xml 的 xmlns 添加:xmlns:task="http://www.springframework.org/schema/task"xsi:schemaLocation添加:http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spr原创 2015-04-28 15:03:45 · 1597 阅读 · 0 评论 -
MAVEN搭建SpirngMVC和Spirng所需的依赖包
org.springframework spring-webmvc 4.1.2.RELEASE org.springframework spring-context-support 4.1.2.RELEASE org.springframework spring-jdbc 4.1.2.RELEASE原创 2015-05-15 15:11:17 · 609 阅读 · 0 评论 -
简单的微服务feign之间调用授权/安全验证
不会写开头,就这样吧~我想让使用这个验证组件开发者配置越少越好所以我使用了注解 类似于springboot的自动装配类创建@EnableSecurityAuth注解作用于在application类上用@Import来注入SecurityAuthAutoConfiguration类SecurityAuthAutoConfiguration是用来注入校验token的Filter当配置文件中只需要生成t...原创 2018-06-13 18:09:54 · 32214 阅读 · 5 评论