package xyz.wbsite.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import xyz.wbsite.frame.base.LocalData;
import xyz.wbsite.frame.base.Token;

import javax.annotation.PostConstruct;

@Configuration
public class TestConfig {

    @Autowired
    private ApplicationContext applicationContext;

    @PostConstruct
    public void initLocalData() {
        LocalData.setContext(applicationContext);
    }

    @Bean
    public Token getTestToken() {
        Token token = new Token();
        token.setId(0);
        token.setUserId(0);
        token.setUserName("system");
        return token;
    }
}