I\'m using Spring to inject JMS connection factory into my Java application. Since this factory is only required within the production environment, not while I\'m developing
In tests null beans can also be injected like this:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = NullTest.class)
@Configuration
public class NullTest {
@Bean(name = "em")
public IEntityManager em() { return null; }
@Bean
public PlatformTransactionManager tm() { return null; }
@Resource
private SomeBean someBean; // this would get em and tm fields autowired to nulls