Skip to content

Commit

Permalink
Fix test, do not keep dependent beans as incomplete.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj authored and jharting committed Mar 9, 2012
1 parent 62a94da commit 70a5a96
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ public T produce(final CreationalContext<T> ctx) {
// Without this, the chaining of decorators will fail as the
// incomplete instance will be resolved
instance = bean.createInstance(ctx);
ctx.push(instance);
// Do not keep dependent instances as incomplete
if (bean.isDependent() == false) {
ctx.push(instance);
}
} else {
T undecoratedInstance = bean.createInstance(ctx);
instance = bean.applyDecorators(undecoratedInstance, ctx, Container.instance().services().get(CurrentInjectionPoint.class).peek());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
public interface WeldCreationalContext<T> extends CreationalContext<T> {

void push(T incompleteInstance);

<S> WeldCreationalContext<S> getCreationalContext(Contextual<S> Contextual);

<S> S getIncompleteInstance(Contextual<S> bean);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

package org.jboss.weld.tests.resolution.weld911;

import javax.enterprise.context.RequestScoped;

/**
* @author Christian Bauer
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
@RequestScoped
public class BarImpl implements Bar {
public Foo foo() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
public class Foo {
public Foo() {
System.out.println("CTOR FOO");
}

@PostConstruct
void init() {
System.out.println("INIT FOO");
Expand Down

0 comments on commit 70a5a96

Please sign in to comment.