断网了……
烟灰学程序一年多了……总在想,要是断网了,我怎么学习……
烟灰就怕断网,断网了,就得完蛋……
常用链接
我的随笔
我的评论
我参与的随笔
随笔分类
(22)
Struts2.1学习(2)
(rss)
Swing_UI开发进度(6)
(rss)
程序开发进度(14)
(rss)
随笔档案
(39)
2010年2月 (2)
2010年1月 (5)
2009年12月 (1)
2009年11月 (2)
2009年8月 (2)
2009年7月 (2)
2009年6月 (2)
2009年5月 (1)
2009年4月 (1)
2009年3月 (6)
2009年2月 (11)
2009年1月 (4)
相册
程序图片
搜索
积分与排名
积分 - 28052
排名 - 178
最新评论
1. re: windows server 2008 安装IIS7碰到的问题
啊啊
--放
2. re: 使用Filter进行非法访问拦截
很久的帖子了,非法访问可以用spring来解决@毕业生
--烟灰这名字被人抢了……
3. re: 使用Filter进行非法访问拦截
评论内容较长,点击标题查看
--毕业生
4. re: windows server 2008 安装IIS7碰到的问题
你这个文章可是帮了我大忙啊......
--myskysoft
5. re: Javascript Remote Object Invoker 6
博主很强大!不错!
--不锈钢水箱
6. re: Javascript Remote Object Invoker 6
恭喜了,向你学习!
--海鲜池
7. re: Javascript Remote Object Invoker 6
是大家看法是打开
--凡客诚品官方网站
8. re: Javascript Remote Object Invoker 2
是空间看时间的方式将
--久久书城
9. re: Javascript Remote Object Invoker 3
是看见的开发时间地方
--凡客诚品官方网
10. re: Javascript Remote Object Invoker 5
阿萨就是大海的
--淘宝网减肥药
阅读排行榜
1. 关于AlphaComposite的理解——Swing UI开发进度 (4861)
2. (转)JDBC与JNDI应用比较(2988)
3. 2009-2-6 再也再也不用JBuilder 搞开发了……(1557)
4. 使用Filter进行非法访问拦截(1540)
5. java LookAndFeel原理 ——Swing UI开发进度(1483)
6. 为了好看,自己做!——Swing UI 开发进度(1314)
7. windows server 2008 安装IIS7碰到的问题(1003)
8. 说说LookAndFeel的工作流程——Swing UI开发进度 (921)
9. 新的一个开始!——Swing UI开发进度 (836)
10. Javascript Remote Object Invoker 3(723)
评论排行榜
1. Javascript Remote Object Invoker 6(5)
2. 使用Filter进行非法访问拦截(4)
3. 关于AlphaComposite的理解——Swing UI开发进度 (3)
4. 2009-2-1 今天开始更新,之后会不断更新 又是一个通宵……(2)
5. 2009-2-6 再也再也不用JBuilder 搞开发了……(2)
6. java LookAndFeel原理 ——Swing UI开发进度(2)
7. 说说LookAndFeel的工作流程——Swing UI开发进度 (2)
8. (转)JDBC与JNDI应用比较(2)
9. windows server 2008 安装IIS7碰到的问题(2)
10. Javascript Remote Object Invoker 5(2)
Powered by:
博客园
模板提供:
沪江博客
IT博客
|
首页
|
发新随笔
|
发新文章
|
联系
| |
管理
Javascript Remote Object Invoker 3
今天完成了IOC对Spring的集成,不论是从WEB配置中读取还是从自定义中读取
这个是该框架配置方式
文件正常配置方式
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE remote-beas PUBLIC
"-//JAVAZONE//DTD Javazone Remote Object Invoker//EN"
"http://www.javazone.org/jroi/dtd/jroi10.dtd"
>
<
remote-beans
>
<
spring-config
>
<
config
name
="application.context.type"
value
="classpath_xml"
/>
<
config
name
="application.context.location"
value
="spring-config.xml"
/>
</
spring-config
>
<
bean
id
="Test1"
class
="testBean"
scope
="spring"
>
</
bean
>
</
remote-beans
>
注意,加入了spring-config的元素
application.context.type是根据Spring的方式划分的,其他的值还有filesystem_xml以及web
注意,spring-config.xml放在src下,或者说是classpath下
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd"
>
<
beans
>
<
bean
id
="testBean"
class
="org.javazone.jroi.example.Test1"
/>
</
beans
>
这个是Spring的配置,没有任何修改或变动,这个不对spring的配置做任何改动
看一下Test1这个类
/** */
/**
*
*/
package
org.javazone.jroi.example;
public
class
Test1
{
@Override
public
String toString()
{
return
"
class org.javazone.jroi.example.Test1 : hashcode =
"
+
hashCode();
}
}
这里打印出的hashCode是为了测试scope
下面是结果
DEBUG
[
2010-01-27 00:38:34:514
][
main
]
(XMLClassPathSystemContext.java:
47
)
-
parse xml document
DEBUG
[
2010-01-27 00:38:34:569
][
main
]
(XMLClassPathSystemContext.java:
52
)
-
initialize system properties constructor
DEBUG
[
2010-01-27 00:38:34:574
][
main
]
(XMLClassPathSystemContext.java:
57
)
-
initialize bean metadata constructor
DEBUG
[
2010-01-27 00:38:34:579
][
main
]
(XMLBeanMetasConstructor.java:
38
)
-
construct bean metas
DEBUG
[
2010-01-27 00:38:34:589
][
main
]
(XMLSpringPropertiesConstructor.java:
36
)
-
construct properties
DEBUG
[
2010-01-27 00:38:34:589
][
main
]
(XMLClassPathSystemContext.java:
68
)
-
initialize IOC Container
INFO
[
2010-01-27 00:38:34:731
][
main
]
(AbstractApplicationContext.java:
411
)
-
Refreshing org.springframework.context.support.ClassPathXmlApplicationContext
@1833955
: display name
[
org.springframework.context.support.ClassPathXmlApplicationContext@1833955
]
; startup date
[
Wed Jan 27 00:38:34 CST 2010
]
; root
of
context hierarchy
INFO
[
2010-01-27 00:38:34:846
][
main
]
(XmlBeanDefinitionReader.java:
323
)
-
Loading XML bean definitions
from
class path resource
[
spring-config.xml
]
DEBUG
[
2010-01-27 00:38:34:846
][
main
]
(DefaultDocumentLoader.java:
72
)
-
Using JAXP provider
[
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
]
DEBUG
[
2010-01-27 00:38:34:851
][
main
]
(BeansDtdResolver.java:
72
)
-
Found beans DTD
[
http://www.springframework.org/dtd/spring-beans-2.0.dtd
]
in
classpath: spring
-
beans
-
2.0
.dtd
DEBUG
[
2010-01-27 00:38:34:876
][
main
]
(DefaultBeanDefinitionDocumentReader.java:
86
)
-
Loading bean definitions
DEBUG
[
2010-01-27 00:38:34:911
][
main
]
(AbstractBeanDefinitionReader.java:
185
)
-
Loaded
1
bean definitions
from
location pattern
[
spring-config.xml
]
INFO
[
2010-01-27 00:38:34:911
][
main
]
(AbstractApplicationContext.java:
426
)
-
Bean factory
for
application context
[
org.springframework.context.support.ClassPathXmlApplicationContext@1833955
]
: org.springframework.beans.factory.support.DefaultListableBeanFactory
@c53dce
DEBUG
[
2010-01-27 00:38:34:911
][
main
]
(AbstractApplicationContext.java:
430
)
-
1
beans defined
in
org.springframework.context.support.ClassPathXmlApplicationContext
@1833955
: display name
[
org.springframework.context.support.ClassPathXmlApplicationContext@1833955
]
; startup date
[
Wed Jan 27 00:38:34 CST 2010
]
; root
of
context hierarchy
DEBUG
[
2010-01-27 00:38:34:931
][
main
]
(AbstractApplicationContext.java:
648
)
-
Unable
to
locate MessageSource
with
name
'
messageSource
'
: using
default
[
org.springframework.context.support.DelegatingMessageSource@1dff3a2
]
DEBUG
[
2010-01-27 00:38:34:931
][
main
]
(AbstractApplicationContext.java:
672
)
-
Unable
to
locate ApplicationEventMulticaster
with
name
'
applicationEventMulticaster
'
: using
default
[
org.springframework.context.event.SimpleApplicationEventMulticaster@87a5cc
]
INFO
[
2010-01-27 00:38:34:936
][
main
]
(DefaultListableBeanFactory.java:
414
)
-
Pre
-
instantiating singletons
in
org.springframework.beans.factory.support.DefaultListableBeanFactory
@c53dce
: defining beans
[
testBean
]
; root
of
factory hierarchy
DEBUG
[
2010-01-27 00:38:34:936
][
main
]
(DefaultSingletonBeanRegistry.java:
214
)
-
Creating shared instance
of
singleton bean
'
testBean
'
DEBUG
[
2010-01-27 00:38:34:941
][
main
]
(AbstractAutowireCapableBeanFactory.java:
383
)
-
Creating instance
of
bean
'
testBean
'
DEBUG
[
2010-01-27 00:38:34:996
][
main
]
(AbstractAutowireCapableBeanFactory.java:
459
)
-
Eagerly caching bean
'
testBean
'
to
allow
for
resolving potential circular
references
DEBUG
[
2010-01-27 00:38:34:998
][
main
]
(AbstractAutowireCapableBeanFactory.java:
411
)
-
Finished creating instance
of
bean
'
testBean
'
DEBUG
[
2010-01-27 00:38:35:001
][
main
]
(BeanContainer.java:
65
)
-
get bean
'
Test1
'
from
container
DEBUG
[
2010-01-27 00:38:35:002
][
main
]
(AbstractBeanFactory.java:
214
)
-
Returning cached instance
of
singleton bean
'
testBean
'
class org.javazone.jroi.example.Test1 : hashcode
=
11423854
注意看最下面一句
(log,使用的是LOG4J)
WEB方式的配置
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE remote-beas PUBLIC
"-//JAVAZONE//DTD Javazone Remote Object Invoker//EN"
"http://www.javazone.org/jroi/dtd/jroi10.dtd"
>
<
remote-beans
>
<
spring-config
>
<
config
name
="application.context.type"
value
="web"
/>
</
spring-config
>
<
bean
id
="Test1"
class
="testBean"
scope
="spring"
>
</
bean
>
</
remote-beans
>
这个只有一点点变化,这里的变化在于value的变化,以及没有了location
<
listener
>
<
listener-class
>
org.javazone.jroi.web.SpringContextListener
</
listener-class
>
</
listener
>
<
context-param
>
<
param-name
>
contextConfigLocation
</
param-name
>
<
param-value
>
classpath:spring-config.xml
</
param-value
>
</
context-param
>
在web.xml中加入SpringContextListener的东东
注意这个东东的配置方式,不是使用的Spring自带的Listener,注意!
package
org.javazone.jroi.example;
import
java.io.IOException;
import
javax.servlet.ServletException;
import
javax.servlet.http.HttpServlet;
import
javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;
import
org.javazone.jroi.cfg.xml.XMLClassPathSystemContext;
import
org.javazone.jroi.ioc.IoContainer;
import
org.javazone.jroi.web.SpringWebContext;
/** */
/**
* Servlet implementation class ExampleServlet
*/
public
class
ExampleServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
public
ExampleServlet()
{
super
();
}
protected
void
doGet(HttpServletRequest request, HttpServletResponse response)
throws
ServletException, IOException
{
doService(request, response);
}
private
void
doService(HttpServletRequest request, HttpServletResponse response)
{
IoContainer ioContainer
=
XMLClassPathSystemContext.configuration(
"
org/javazone/jroi/example/jroi.config.xml
"
).getIoContainer();
System.out.println(ioContainer.getBean(
"
Test1
"
));
System.out.println(ioContainer.getBean(
"
Test2
"
));
}
protected
void
doPost(HttpServletRequest request, HttpServletResponse response)
throws
ServletException, IOException
{
doService(request, response);
}
}
测试用的Servlet
下面是结果,其实是一样的
2010
-
1
-
27
0
:
49
:
24
org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance
in
production environments was
not
found
on
the java.library.path: G:\Eclipse JEE
3.4
\jre\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;G:
/
Eclipse JEE
3.5
/
jre
/
bin
/
client;G:
/
Eclipse JEE
3.5
/
jre
/
bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.
0
\;C:\Program Files (x86)\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files (x86)\Rational\common;C:\Program Files\Common Files\Microsoft Shared\Windows Live
2010
-
1
-
27
0
:
49
:
24
org.apache.tomcat.util.digester.SetPropertiesRule
begin
警告:
[
SetPropertiesRule
]
{Server
/
Service
/
Engine
/
Host
/
Context} Setting property
'
source
'
to
'
org.eclipse.jst.jee.server:org.javazone.jroi
'
did
not
find a matching property.
2010
-
1
-
27
0
:
49
:
24
org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP
/
1.1
on
http
-
8080
2010
-
1
-
27
0
:
49
:
24
org.apache.catalina.startup.Catalina
load
信息: Initialization processed
in
695
ms
2010
-
1
-
27
0
:
49
:
24
org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010
-
1
-
27
0
:
49
:
24
org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat
/
6.0
.
24
2010
-
1
-
27
0
:
49
:
25
org.apache.catalina.core.ApplicationContext
log
信息: Initializing Spring root WebApplicationContext
DEBUG
[
2010-01-27 00:49:25:511
][
main
]
(SpringContextListener.java:
30
)
-
create
spring context listener
INFO
[
2010-01-27 00:49:25:521
][
main
]
(ContextLoader.java:
189
)
-
Root WebApplicationContext: initialization started
INFO
[
2010-01-27 00:49:25:619
][
main
]
(AbstractApplicationContext.java:
411
)
-
Refreshing org.springframework.web.context.support.XmlWebApplicationContext
@11ca803
: display name
[
Root WebApplicationContext
]
; startup date
[
Wed Jan 27 00:49:25 CST 2010
]
; root
of
context hierarchy
INFO
[
2010-01-27 00:49:25:781
][
main
]
(XmlBeanDefinitionReader.java:
323
)
-
Loading XML bean definitions
from
class path resource
[
spring-config.xml
]
DEBUG
[
2010-01-27 00:49:25:799
][
main
]
(DefaultDocumentLoader.java:
72
)
-
Using JAXP provider
[
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
]
DEBUG
[
2010-01-27 00:49:25:813
][
main
]
(BeansDtdResolver.java:
72
)
-
Found beans DTD
[
http://www.springframework.org/dtd/spring-beans-2.0.dtd
]
in
classpath: spring
-
beans
-
2.0
.dtd
DEBUG
[
2010-01-27 00:49:25:829
][
main
]
(DefaultBeanDefinitionDocumentReader.java:
86
)
-
Loading bean definitions
DEBUG
[
2010-01-27 00:49:25:878
][
main
]
(AbstractBeanDefinitionReader.java:
185
)
-
Loaded
1
bean definitions
from
location pattern
[
classpath:spring-config.xml
]
INFO
[
2010-01-27 00:49:25:879
][
main
]
(AbstractApplicationContext.java:
426
)
-
Bean factory
for
application context
[
org.springframework.web.context.support.XmlWebApplicationContext@11ca803
]
: org.springframework.beans.factory.support.DefaultListableBeanFactory
@16acdd1
DEBUG
[
2010-01-27 00:49:25:879
][
main
]
(AbstractApplicationContext.java:
430
)
-
1
beans defined
in
org.springframework.web.context.support.XmlWebApplicationContext
@11ca803
: display name
[
Root WebApplicationContext
]
; startup date
[
Wed Jan 27 00:49:25 CST 2010
]
; root
of
context hierarchy
DEBUG
[
2010-01-27 00:49:25:928
][
main
]
(AbstractApplicationContext.java:
648
)
-
Unable
to
locate MessageSource
with
name
'
messageSource
'
: using
default
[
org.springframework.context.support.DelegatingMessageSource@b60b93
]
DEBUG
[
2010-01-27 00:49:25:937
][
main
]
(AbstractApplicationContext.java:
672
)
-
Unable
to
locate ApplicationEventMulticaster
with
name
'
applicationEventMulticaster
'
: using
default
[
org.springframework.context.event.SimpleApplicationEventMulticaster@100ebec
]
DEBUG
[
2010-01-27 00:49:25:944
][
main
]
(UiApplicationContextUtils.java:
85
)
-
Unable
to
locate ThemeSource
with
name
'
themeSource
'
: using
default
[
org.springframework.ui.context.support.ResourceBundleThemeSource@1938039
]
INFO
[
2010-01-27 00:49:25:946
][
main
]
(DefaultListableBeanFactory.java:
414
)
-
Pre
-
instantiating singletons
in
org.springframework.beans.factory.support.DefaultListableBeanFactory
@16acdd1
: defining beans
[
testBean
]
; root
of
factory hierarchy
DEBUG
[
2010-01-27 00:49:25:959
][
main
]
(DefaultSingletonBeanRegistry.java:
214
)
-
Creating shared instance
of
singleton bean
'
testBean
'
DEBUG
[
2010-01-27 00:49:25:962
][
main
]
(AbstractAutowireCapableBeanFactory.java:
383
)
-
Creating instance
of
bean
'
testBean
'
DEBUG
[
2010-01-27 00:49:26:076
][
main
]
(AbstractAutowireCapableBeanFactory.java:
459
)
-
Eagerly caching bean
'
testBean
'
to
allow
for
resolving potential circular
references
DEBUG
[
2010-01-27 00:49:26:078
][
main
]
(AbstractAutowireCapableBeanFactory.java:
411
)
-
Finished creating instance
of
bean
'
testBean
'
DEBUG
[
2010-01-27 00:49:26:079
][
main
]
(ContextLoader.java:
204
)
-
Published root WebApplicationContext
as
ServletContext attribute
with
name
[
org.springframework.web.context.WebApplicationContext.ROOT
]
INFO
[
2010-01-27 00:49:26:079
][
main
]
(ContextLoader.java:
209
)
-
Root WebApplicationContext: initialization completed
in
558
ms
DEBUG
[
2010-01-27 00:49:26:080
][
main
]
(SpringContextListener.java:
36
)
-
initialize spring web application context
2010
-
1
-
27
0
:
49
:
26
org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP
/
1.1
on
http
-
8080
2010
-
1
-
27
0
:
49
:
26
org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening
on
/
0.0
.
0.0
:
8009
2010
-
1
-
27
0
:
49
:
26
org.apache.jk.server.JkMain start
信息: Jk running ID
=
0
time
=
0
/
96
config
=
null
2010
-
1
-
27
0
:
49
:
26
org.apache.catalina.startup.Catalina start
信息: Server startup
in
1620
ms
DEBUG
[
2010-01-27 00:49:37:635
][
http-8080-1
]
(XMLClassPathSystemContext.java:
47
)
-
parse xml document
DEBUG
[
2010-01-27 00:49:37:651
][
http-8080-1
]
(XMLClassPathSystemContext.java:
52
)
-
initialize system properties constructor
DEBUG
[
2010-01-27 00:49:37:656
][
http-8080-1
]
(XMLClassPathSystemContext.java:
57
)
-
initialize bean metadata constructor
DEBUG
[
2010-01-27 00:49:37:666
][
http-8080-1
]
(XMLBeanMetasConstructor.java:
38
)
-
construct bean metas
DEBUG
[
2010-01-27 00:49:37:676
][
http-8080-1
]
(XMLSpringPropertiesConstructor.java:
36
)
-
construct properties
DEBUG
[
2010-01-27 00:49:37:676
][
http-8080-1
]
(XMLClassPathSystemContext.java:
68
)
-
initialize IOC Container
DEBUG
[
2010-01-27 00:49:37:719
][
http-8080-1
]
(BeanContainer.java:
65
)
-
get bean
'
Test1
'
from
container
DEBUG
[
2010-01-27 00:49:37:720
][
http-8080-1
]
(AbstractBeanFactory.java:
214
)
-
Returning cached instance
of
singleton bean
'
testBean
'
class org.javazone.jroi.example.Test1 : hashcode
=
6781414
DEBUG
[
2010-01-27 00:49:37:721
][
http-8080-1
]
(BeanContainer.java:
65
)
-
get bean
'
Test2
'
from
container
WARN
[
2010-01-27 00:49:37:721
][
http-8080-1
]
(BeanContainer.java:
74
)
-
the bean named
'
Test2
'
was
not
be found
null
上面的所有都是log,所以只需要看最下面几行
OK,今天的工作告一段落
发表于 2010-01-27 00:51
烟灰这名字被人抢了……
阅读(723)
评论(2)
编辑
收藏
引用
所属分类:
程序开发进度
评论
#
re: Javascript Remote Object Invoker 3
回复
更多评论
是看见的开发时间地方
刷新评论列表
只有注册用户
登录
后才能发表评论。