How to inject a @Named bean into a Junit test

Kristof Neirynck

I'm trying to inject a @Named bean into a Junit test.

This works in my ejb module, but the same approach in my war module fails. I'd like to know why I get org.apache.openejb.OpenEJBException: Creating application failed: couldn't start owb context.

I know this looks like the same issue as in Issue with EJB 3.1 injected with CDI bean while running JUnit, but it can't be the same as it works in another module.

The source code is here: https://github.com/Crydust/guestbook

Working test: guestbook/guestbook-ejb/src/test/java/be/crydust/guestbook/ejb/PostBoundaryTest.java

Failing test: guestbook/guestbook-web/src/test/java/be/crydust/guestbook/web/PostBackingTest.java

Source of failing test (imports ommitted):

public class PostBackingTest {

    private static EJBContainer ejbContainer;

    @Inject
    PostBacking cut;

    @BeforeClass
    public static void startTheContainer() {
        ejbContainer = EJBContainer.createEJBContainer();
    }

    @Before
    public void setUp() throws Exception {
        ejbContainer.getContext().bind("inject", this);
    }

    @AfterClass
    public static void afterClass() {
        if (ejbContainer != null) {
            ejbContainer.close();
        }
    }

    // FIXME injection fails

    @Test
    public void testInjected() {
        assertThat(cut, is(not(nullValue())));
    }
}

Log of failing test:

cd D:\home\kristof\Projects\guestbook\guestbook-web; JAVA_HOME=C:\\opt\\Java\\jdk1.7.0_45 cmd /c "\"\"C:\\opt\\NetBeans 7.4\\java\\maven\\bin\\mvn.bat\" -Dmaven.ext.class.path=\"C:\\opt\\NetBeans 7.4\\java\\maven-nblib\\netbeans-eventspy.jar\" test\""
Scanning for projects...

------------------------------------------------------------------------
Building guestbook-web 1.0-SNAPSHOT
------------------------------------------------------------------------

--- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (prepare-agent) @ guestbook-web ---
surefireArgLine set to -javaagent:D:\home\kristof\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\home\kristof\Projects\guestbook\guestbook-web\target\jacoco.exec 

--- maven-resources-plugin:2.5:resources (default-resources) @ guestbook-web ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource

--- maven-dependency-plugin:2.8:copy (copy) @ guestbook-web ---
Configured Artifact: org.apache.openejb:openejb-javaagent:4.6.0:jar
org.apache.openejb:openejb-javaagent:4.6.0:jar already exists in D:\home\kristof\Projects\guestbook\guestbook-web\target

--- maven-compiler-plugin:3.1:compile (default-compile) @ guestbook-web ---
Nothing to compile - all classes are up to date

--- maven-resources-plugin:2.5:testResources (default-testResources) @ guestbook-web ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\home\kristof\Projects\guestbook\guestbook-web\src\test\resources

--- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ guestbook-web ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.16:test (default-test) @ guestbook-web ---
Surefire report directory: D:\home\kristof\Projects\guestbook\guestbook-web\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
98  classpath-bootstrap  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded a validation provider.
Running be.crydust.guestbook.web.PostBackingTest
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: OpenEJB http://openejb.apache.org/
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Startup: Tue Dec 17 12:16:48 CET 2013
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Copyright 1999-2013 (C) Apache OpenEJB Project, All Rights Reserved.
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Version: 4.6.0
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build date: 20131117
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build time: 06:49
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.home = D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:48 PM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.base = D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@31185f32
dec 17, 2013 12:16:48 PM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Succeeded in installing singleton service
dec 17, 2013 12:16:48 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'javax.ejb.embeddable.EJBContainer=true'
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigUtils searchForConfiguration
INFO: Cannot find the configuration file [conf/openejb.xml].  Will attempt to create one for the beans deployed.
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
dec 17, 2013 12:16:48 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
dec 17, 2013 12:16:48 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
dec 17, 2013 12:16:48 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Default Security Service)
dec 17, 2013 12:16:48 PM org.apache.openejb.config.DeploymentsResolver processUrls
INFO: Found PersistenceModule in classpath: d:\home\kristof\.m2\repository\be\crydust\guestbook-entities\1.0-snapshot\guestbook-entities-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.DeploymentsResolver processUrls
INFO: Found EjbModule in classpath: d:\home\kristof\.m2\repository\be\crydust\guestbook-ejb\1.0-snapshot\guestbook-ejb-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory loadApplication
INFO: Beginning load: d:\home\kristof\.m2\repository\be\crydust\guestbook-entities\1.0-snapshot\guestbook-entities-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory loadApplication
INFO: Beginning load: d:\home\kristof\.m2\repository\be\crydust\guestbook-ejb\1.0-snapshot\guestbook-ejb-1.0-snapshot.jar
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM org.apache.openejb.config.InitEjbDeployments deploy
INFO: Auto-deploying ejb PostBoundary: EjbDeployment(deployment-id=PostBoundary)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean guestbook-ejb-1.0-SNAPSHOT.Comp577600423: Container(type=MANAGED, id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Managed Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.core.managed.SimplePassivater init
INFO: Using directory C:\Users\kristof\AppData\Local\Temp for stateful session passivation
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean PostBoundary: Container(type=STATELESS, id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Stateless Container)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring PersistenceUnit(name=guestbookPU)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig logAutoCreateResource
INFO: Auto-creating a Resource with id 'Default JDBC Database' of type 'DataSource for 'guestbookPU'.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=Default JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Unmanaged JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig logAutoCreateResource
INFO: Auto-creating a Resource with id 'Default Unmanaged JDBC Database' of type 'DataSource for 'guestbookPU'.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=Default Unmanaged JDBC Database)
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit guestbookPU <jta-data-source> to Resource ID 'Default JDBC Database' from 'null'
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AutoConfig setNonJtaDataSource
INFO: Adjusting PersistenceUnit guestbookPU <non-jta-data-source> to Resource ID 'Default Unmanaged JDBC Database' from 'null'
dec 17, 2013 12:16:49 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "D:\home\kristof\Projects\guestbook\guestbook-web\target" loaded.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM null
INFO: OpenJPA dynamically loaded a validation provider.
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
INFO: PersistenceUnit(name=guestbookPU, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 12ms
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.JndiBuilder bindJava
INFO: Jndi(name="java:global/guestbook-ejb-1.0-SNAPSHOT/PostBoundary!be.crydust.guestbook.ejb.PostBoundary")
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.JndiBuilder bindJava
INFO: Jndi(name="java:global/guestbook-ejb-1.0-SNAPSHOT/PostBoundary")
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@31185f32
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
dec 17, 2013 12:16:49 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
dec 17, 2013 12:16:49 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
SEVERE: CDI Beans module deployment failed
org.apache.webbeans.exception.inject.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [be.crydust.guestbook.web.PostBacking] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  cut, Bean Owner : [PostBackingTest, Name:null, WebBeans Type:ENTERPRISE, API Types:[be.crydust.guestbook.web.PostBackingTest,java.lang.Object,java.io.Serializable], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
    at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:213)
    at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:187)
    at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:162)
    at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:799)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
    at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
    at be.crydust.guestbook.web.PostBackingTest.startTheContainer(PostBackingTest.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [be.crydust.guestbook.web.PostBacking] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  cut, Bean Owner : [PostBackingTest, Name:null, WebBeans Type:ENTERPRISE, API Types:[be.crydust.guestbook.web.PostBackingTest,java.lang.Object,java.io.Serializable], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
    at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
    at org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:195)
    at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:954)
    at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:470)
    at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:420)
    at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:200)
    ... 25 more

dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyApplication
INFO: Undeploying app: D:\home\kristof\Projects\guestbook\guestbook-web\target
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: Default JDBC Database
dec 17, 2013 12:16:49 PM org.apache.openejb.assembler.classic.Assembler destroyResource
INFO: Closing DataSource: Default Unmanaged JDBC Database
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.458 sec <<< FAILURE! - in be.crydust.guestbook.web.PostBackingTest
be.crydust.guestbook.web.PostBackingTest  Time elapsed: 1.458 sec  <<< ERROR!
org.apache.openejb.OpenEjbContainer$AssembleApplicationException: org.apache.openejb.OpenEJBException: Creating application failed: D:\home\kristof\Projects\guestbook\guestbook-web\target: couldn't start owb context
    at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)
    at org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:195)
    at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:954)
    at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:470)
    at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:420)
    at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:200)
    at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:187)
    at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:162)
    at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:799)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612)
    at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:415)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:43)
    at be.crydust.guestbook.web.PostBackingTest.startTheContainer(PostBackingTest.java:31)


Results :

Tests in error: 
  PostBackingTest.startTheContainer:31 » AssembleApplication org.apache.openejb....

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.595s
Finished at: Tue Dec 17 12:16:49 CET 2013
Final Memory: 17M/224M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project guestbook-web: There are test failures.

Please refer to D:\home\kristof\Projects\guestbook\guestbook-web\target\surefire-reports for the individual test results.
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Jan Galinski

I use the needle framework for these kind of tests. It automatically injects mocks that you can configure the usual way, but also can be used to inject real instances if needed (for collaboration/integration testing).

You can find it here: http://needle.spree.de/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to inject a @Named bean into a Junit test

From Dev

How to inject dataSource default bean in Spring Boot integration test

From Dev

How can I inject property source of a bean in test

From Dev

Unable to inject dependency in Junit test

From Dev

Doing bean inject in camel test

From Dev

inject the same @SessionScoped Bean in different @Named Beans

From Dev

Can't inject DAO in Junit test with Spring

From Dev

Inject data into session from JUnit test

From Dev

mock bean unable to inject dependecy in unit test

From Dev

mock bean unable to inject dependecy in unit test

From Dev

How to inject one bean to a set of bean in spring?

From Dev

How to inject ApplicationScoped bean in Stateless bean?

From Dev

How to inject raw Class to bean

From Dev

How to inject bean in a Tapestry service

From Dev

How to inject raw Class to bean

From Dev

How to inject bean in a Tapestry service

From Dev

How do I inject dependencies in Junit test case using Guice before @Rule runs?

From Dev

NoSuchBeanDefinitionException - No bean named blPU is defined - Cannot inject EntityManager JPA

From Dev

How do I inject named dependencies in to a controller?

From Dev

How to Inject a context from a test

From Dev

How to inject a prototype bean in a Spring singleton Controller

From Dev

How to inject a bean in this MongoDB connection case?

From Dev

How to correct inject map of bean in spring context

From Dev

Spring: How to inject a String bean to the constructor?

From Dev

How to inject fields in bean-methods?

From Dev

How to inject bean validator automatically enabled by JPA?

From Dev

Dagger and AndroidAnnotations - how to inject @Pref, @Bean, etc?

From Dev

How to inject the same bean instance into multiple beans

From Dev

How many ways to inject the bean automatically in spring?

Related Related

  1. 1

    How to inject a @Named bean into a Junit test

  2. 2

    How to inject dataSource default bean in Spring Boot integration test

  3. 3

    How can I inject property source of a bean in test

  4. 4

    Unable to inject dependency in Junit test

  5. 5

    Doing bean inject in camel test

  6. 6

    inject the same @SessionScoped Bean in different @Named Beans

  7. 7

    Can't inject DAO in Junit test with Spring

  8. 8

    Inject data into session from JUnit test

  9. 9

    mock bean unable to inject dependecy in unit test

  10. 10

    mock bean unable to inject dependecy in unit test

  11. 11

    How to inject one bean to a set of bean in spring?

  12. 12

    How to inject ApplicationScoped bean in Stateless bean?

  13. 13

    How to inject raw Class to bean

  14. 14

    How to inject bean in a Tapestry service

  15. 15

    How to inject raw Class to bean

  16. 16

    How to inject bean in a Tapestry service

  17. 17

    How do I inject dependencies in Junit test case using Guice before @Rule runs?

  18. 18

    NoSuchBeanDefinitionException - No bean named blPU is defined - Cannot inject EntityManager JPA

  19. 19

    How do I inject named dependencies in to a controller?

  20. 20

    How to Inject a context from a test

  21. 21

    How to inject a prototype bean in a Spring singleton Controller

  22. 22

    How to inject a bean in this MongoDB connection case?

  23. 23

    How to correct inject map of bean in spring context

  24. 24

    Spring: How to inject a String bean to the constructor?

  25. 25

    How to inject fields in bean-methods?

  26. 26

    How to inject bean validator automatically enabled by JPA?

  27. 27

    Dagger and AndroidAnnotations - how to inject @Pref, @Bean, etc?

  28. 28

    How to inject the same bean instance into multiple beans

  29. 29

    How many ways to inject the bean automatically in spring?

HotTag

Archive