java
京之火
人生很短,孤独很长,勇敢的去追求极致,累了就歇一会!
展开
-
初学spring init-method="init" destroy-method="destroy" scope="prototype"
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" xsi:schemaLocation="http:/原创 2015-03-21 15:24:34 · 1278 阅读 · 0 评论 -
spring 简单属性注入
如果不重写toString方法则打印类名原创 2015-07-14 16:54:24 · 308 阅读 · 0 评论 -
spring IOC 集合collections注入
集合注入:原创 2015-07-14 17:09:59 · 526 阅读 · 0 评论 -
spring Bean范围scope=singleton或prototype
当scope=singleton是单例,service和service2是同一个对象,当scope=prototype是每次创建新的对象原创 2015-07-14 17:00:32 · 504 阅读 · 0 评论 -
spring setter and constructor注入
setter: 注意:setter注入默认调用空的构造方法,如果添加了其他有参数的构造方法,需要在写一个空的构造方法,否则会报错constructor:原创 2015-07-14 16:31:46 · 390 阅读 · 0 评论 -
spring 自动装配autowire=byName或byType
注意byName的情况下,bean 的name=userDao要和实现类的接口名一致,可以写多个bean,如byType的时候就不需要,但是只能有一个bean,唯一bean。原创 2015-07-14 17:40:26 · 648 阅读 · 0 评论