- 浏览: 204238 次
- 性别:
- 来自: 北京
最新评论
-
泛白的墨色天空:
赞。解决了我的问题。
Spring ioc注解方式获取bean
文章列表
package com.astute.sparrow.spring.ioc.method_injection;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ObjectFactory;
import org.spr ...
package com.astute.sparrow.spring.ioc.method_injection;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ObjectFactory;
import org.spring ...
/**
* A FactoryBean implementation that
* returns a value which is an ObjectFactory
* that in turn returns a bean sourced from a BeanFactory.
*
* As such, this may be used to avoid having a client object directly calling BeanFactory#getBean(String) to get
* a (typically prototype) bean ...
package com.astute.sparrow.spring.ioc.method_injection;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;
import org ...
package com.astute.sparrow.spring.ioc.method_injection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component("a")
public class A {
@Autowired
...
package com.astute.sparrow.spring.ioc.method_injection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component("a")
public class A {
@Autowired
...
构造方法注入:
<bean id="a" class="com.astute.sparrow.spring.ioc.test.A">
<constructor-arg type="int">
<value>12345</value>
</constructor-arg>
</bean>
<bean id="a" class="com.astute.sparrow.spring.ioc.test.A& ...
package com.ls.spring.ioc.dummy;
import org.springframework.stereotype.Component;
@Component
public class B {
public void put() {
System.out.println("B is outing...");
}
}
package com.ls.spring.ioc.dummy;
import org.springframework.beans.factory.annotation.Autow ...
package com.ls.spring.ioc.dummy;
import org.springframework.stereotype.Component;
@Component
public class B {
public void put() {
System.out.println("B is outing...");
}
}
package com.ls.spring.ioc.dummy;
import org.springframework.beans.factory.annotation.Autow ...
package com.ls.spring.ioc.dummy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class A {
@Autowired
private B b;
public A() {
super();
}
public A(B b) {
super();
this.b = b;
}
...
package com.astute.sparrow.spring.ioc.test;
public class B {
public void output() {
System.out.println("B.output");
}
}
package com.astute.sparrow.spring.ioc.test;
public class A {
private B b;
public A() {
}
public A(B b) {
super();
this.b ...
1. Ctrl + / 所选择的行用 "//"注释
2. Ctrl + Shift + / 所选择的行 用 "/* */" 来注释
3. Alt + / 补全提示 , 参数提示, 方法提示
4 Ctrl + d 删除整行
5 ctrl + F11 快速运行
6 全局 调试上次启动 F11
7 ctrl + shift + o 自动导入未导入(import)的类。
8 全局 单步跳过 F6
9 Tab 使选中的代码向右
10 Shift +Tab 使选中的代码向左
11 鼠标放在对应的类上 按 F3 会跳到对应的类定义文件中( ...
免安装Oracle客户端使用PL/SQL连接Oracle
免安装Oracle客户端使用PL/SQL连接Oracle 大家都知道,用PL/SQL连接Oracle,是需要安装Oracle客户端软件的。有没要想过不安装Or
示例程序
在打开相应的文件、将输入数据读入名为 inputData 的 ByteBuffer 之后,我们的程序必须创建 ISO-8859-1 (Latin1) 字符集的一个实例:
Charset latin1 = Charset.forName( "ISO-8859-1" );
然后,创建一个解码器(用于读取)和一个编码器 (用于写入):
CharsetDecoder decoder = latin1.newDecoder();
CharsetEncoder encoder = latin1.newEncoder();
为了将字节 ...
ibm dw nio入门异步io的例子
package com.ls.java.newio;
import java.io.*;
import java.net.*;
import java.nio.*;
import java.nio.channels.*;
import java.util.*;
public class MultiPortEcho {
private int ports[];
private ByteBuffer echoBuffer = ByteBuffer.allocate(1024);
public MultiPortEch ...