---
title: "spring 注解测试用例"
author: "xiaowei2002"
date: "2015-05-20T19:01:30Z"
tags: []
categories: ["企业架构"]
slug: "spring"
draft: false
lastmod: "2015-05-20T19:30:52Z"
id: 2212970
url: "https://xiaowei2002.iteye.com/blog/2212970"
---

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](mailto:%7B@ComponentScan.Filter%28Aspect.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&lt;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();  
    }

}