spring 注解测试用例

package com.hyxt.test.cash;


import com.hyxt.data.cash.service.ActivityService;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.*;

@Configuration
@ComponentScan(basePackages = "com.hyxt",includeFilters = {@ComponentScan.Filter(Aspect.class)})
@PropertySource("classpath:application.properties")
//@ImportResource(value = {"classpath:dubbo.xml","classpath:rabbitmq-example.xml","classpath:restfull.xml"})
@EnableAutoConfiguration
public class TestSpring {
    public static void main(String[] args) throws InterruptedException {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext("com.hyxt");
        for(int i=0;i<12;i++){
            System.out.println(" i === " + context.getBeanDefinitionNames()[i]);;
        }

     /*   ActivityService ds = (ActivityService)context.getBean("ActivityService");

        System.out.println(ds.getClass());
       *//* Thread.sleep(10000);*/
        //System.out.println(ds.sayHello());*/
        context.close();
    }

}

你可能感兴趣的:(spring)