Package org.springframework.context

Examples of org.springframework.context.ApplicationContext.containsBean()


    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
      "/org/springframework/web/context/WEB-INF/context-addition.xml" });
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertTrue("Has kerry", context.containsBean("kerry"));
  }

  public void testSingletonDestructionOnStartupFailure() throws IOException {
    try {
View Full Code Here


    context = new ClassPathXmlApplicationContext(new String[] {
      "/org/springframework/web/context/WEB-INF/applicationContext.xml",
      "/org/springframework/web/context/WEB-INF/context-addition.xml" });
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertTrue("Has kerry", context.containsBean("kerry"));
  }

  public void testSingletonDestructionOnStartupFailure() throws IOException {
    try {
      new ClassPathXmlApplicationContext(new String[] {
View Full Code Here

public class ComponentScanParserWithUserDefinedStrategiesTests extends AbstractDependencyInjectionSpringContextTests {

  public void testCustomBeanNameGenerator() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/customNameGeneratorTests.xml");
    assertTrue(context.containsBean("testing.fooServiceImpl"));
  }

  public void testCustomScopeMetadataResolver() {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/customScopeResolverTests.xml");
View Full Code Here

public class ComponentScanParserTests extends TestCase {

  public void testAspectJTypeFilter() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
  }

  public void testNonMatchingResourcePattern() {
View Full Code Here

  public void testAspectJTypeFilter() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
  }

  public void testNonMatchingResourcePattern() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
View Full Code Here

  public void testAspectJTypeFilter() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/aspectjTypeFilterTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
    assertTrue(context.containsBean("stubFooDao"));
    assertFalse(context.containsBean("scopedProxyTestBean"));
  }

  public void testNonMatchingResourcePattern() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/nonMatchingResourcePatternTests.xml");
View Full Code Here

  }

  public void testNonMatchingResourcePattern() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/nonMatchingResourcePatternTests.xml");
    assertFalse(context.containsBean("fooServiceImpl"));
  }

  public void testMatchingResourcePattern() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/matchingResourcePatternTests.xml");
View Full Code Here

  }

  public void testMatchingResourcePattern() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/matchingResourcePatternTests.xml");
    assertTrue(context.containsBean("fooServiceImpl"));
  }

  public void testComponentScanWithAutowiredQualifier() {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/context/annotation/componentScanWithAutowiredQualifierTests.xml");
View Full Code Here

        ApplicationContext ctx = this.getContext(filterConfig);

        String beanName = null;

        if ((targetBean != null) && ctx.containsBean(targetBean)) {
            beanName = targetBean;
        } else if (targetBean != null) {
            throw new ServletException("targetBean '" + targetBean + "' not found in context");
        } else {
            String targetClassString = filterConfig.getInitParameter("targetClass");
View Full Code Here

  private void doResetAdminUser() {
    System.out.println("###### ==> Run Job for resetting the demo data.");

    ApplicationContext ctx = ApplicationContextProvider.getApplicationContext();

    if (ctx != null && ctx.containsBean("userService")) {
      NonWebRequestDBAction nonWebRequestDBAction = (NonWebRequestDBAction) ctx.getBean("nonWebRequestDBAction");
      if (nonWebRequestDBAction != null) {
        System.out.println("###### ==> Reset admin name/password.");
        nonWebRequestDBAction.resetAdminPassword();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.