天天看點

spring boot使用注解的方式測試bean

package com.csair.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com..Springboot;
import com.csair.cbd.efficacy.domain.CbdTicketsaleData;
import com.google.gson.annotations.JsonAdapter;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Springboot.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EnableAutoConfiguration
public class SpringDaoTest {
   
   @Autowired
   Service service;
   @Test
    public void getHeader() throws Exception {
      //具體調用方法
      
      
      
      
   
    }
}
      

繼續閱讀