Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.-Smile-.
spring-framework
提交
629e2a03
S
spring-framework
项目概览
.-Smile-.
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
629e2a03
编写于
10月 28, 2015
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Explicit notes on programmatic JNDI lookups in @Bean methods
Issue: SPR-8129
上级
0579e61a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
3 deletion
+16
-3
src/asciidoc/core-beans.adoc
src/asciidoc/core-beans.adoc
+16
-3
未找到文件。
src/asciidoc/core-beans.adoc
浏览文件 @
629e2a03
...
...
@@ -6227,9 +6227,9 @@ method are automatically enlisted with a destruction callback. If you have a pub
shuts
down
,
simply
add
`@
Bean
(
destroyMethod
=
""
)`
to
your
bean
definition
to
disable
the
default
`(
inferred
)`
mode
.
You
may
want
to
do
that
by
default
for
a
resource
that
you
acquire
via
JNDI
as
its
lifecycle
is
managed
outside
the
application
.
In
particular
,
make
sure
to
always
do
it
for
a
`
DataSource
`
as
it
is
known
to
be
problematic
.
You
may
want
to
do
that
by
default
for
a
resource
that
you
acquire
via
JNDI
as
its
lifecycle
is
managed
outside
the
application
.
In
particular
,
make
sure
to
always
do
it
for
a
`
DataSource
`
as
it
is
known
to
be
problematic
on
Java
EE
application
servers
.
[
source
,
java
,
indent
=
0
]
[
subs
=
"verbatim,quotes"
]
...
...
@@ -6240,6 +6240,12 @@ is managed outside the application. In particular, make sure to always do it for
}
----
Also
,
with
`@
Bean
`
methods
,
you
will
typically
choose
to
use
programmatic
JNDI
lookups
:
either
using
Spring
's `JndiTemplate`/`JndiLocatorDelegate` helpers or straight JNDI
`InitialContext` usage, but not the `JndiObjectFactoryBean` variant which would force
you to declare the return type as the `FactoryBean` type instead of the actual target
type, making it harder to use for cross-reference calls in other `@Bean` methods that
intend to refer to the provided resource here.
====
Of course, in the case of `Foo` above, it would be equally as valid to call the `init()`
...
...
@@ -7190,6 +7196,13 @@ can rewrite the `dataSource` configuration as follows:
}
----
[NOTE]
====
As mentioned before, with `@Bean` methods, you will typically choose to use programmatic
JNDI lookups: either using Spring'
s
`
JndiTemplate
`/`
JndiLocatorDelegate
`
helpers
or
the
straight
JNDI
`
InitialContext
`
usage
shown
above
,
but
not
the
`
JndiObjectFactoryBean
`
variant
which
would
force
you
to
declare
the
return
type
as
the
`
FactoryBean
`
type
.
====
`@
Profile
`
can
be
used
as
a
<<
beans
-
meta
-
annotations
,
meta
-
annotation
>>
for
the
purpose
of
creating
a
custom
_composed
annotation_
.
The
following
example
defines
a
custom
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录