Spring
文文流云
这个作者很懒,什么都没留下…
展开
-
spring使用注解方式读取properties文件时读取不到对应的值
问题现象:使用注解方式读取properties文件时,发现读取不到该属性值:代码如下import java.beans.PropertyVetoException;import org.springframework.beans.factory.annotation.Value;import org.springframework.beans.factory.config.Propert...原创 2019-09-01 17:58:25 · 3458 阅读 · 2 评论 -
@Bean修饰的方法参数的注入方式
@Bean修饰的方法参数的注入方式:方法参数默认注入方式类型Autowired: 1:复杂类型可以通过@Qualifier(value=“XXX”)限定; 2:对于普通类型使用@Value(XXX)指定; @PropertySource("classpath:db.properties")public class SpringConfiguration { @Bean p...原创 2019-09-02 15:24:50 · 7466 阅读 · 2 评论 -
spring-aop注解实现
直接来代码/** * 进行AOP测试的通知类 */@Component("myLogger") // 通知类加入容器@EnableAspectJAutoProxy // 开启AOP@Aspect // 该类设置为切面public class MyLogger { @Pointcut("execution(* com.liujunwen.jdbc.service.*....原创 2019-09-02 15:49:33 · 154 阅读 · 0 评论 -
spring-aop的xml配置实现
beans.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.sp...原创 2019-09-02 21:40:34 · 101 阅读 · 0 评论 -
spring事务-xml方式
beans.xml配置<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www....原创 2019-09-02 22:37:38 · 153 阅读 · 0 评论 -
spring事务-xml+注解组合实现
beans.xml## 标题<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://w...原创 2019-09-02 22:46:38 · 217 阅读 · 0 评论 -
spring事务-纯注解实现
配置类:SpringConfiguration.java 取代beans.xml配置文件/* * Copyright (c) 2019, wenwenliuyun@163.com All Rights Reserved. */package com.liuyun.config;import javax.sql.DataSource;import org.springframew...原创 2019-09-02 22:59:44 · 850 阅读 · 1 评论 -
Spring + Hibernate整合
maven工程依赖pom.xml:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apa...原创 2019-09-10 16:39:50 · 145 阅读 · 0 评论 -
Spring + Hibernate整合(无hibernate.cfg.xml,无映射文件)
依据前一篇《Spring + Hibernate整合》:https://blog.csdn.net/wenwenliuyunabcd/article/details/100703434,进行修改spring容器配置beans.xml:此处同时做了下事务的注解驱动<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http...原创 2019-09-10 17:23:33 · 653 阅读 · 0 评论