静态变量
@Component @PropertySource("classpath:mail.properties") public class TestUtil { private static String star; @Autowired public TestUtil(@Value("${mail.smtp.username}")String star) { TestUtil.star = star; }
静态类
@Component public class StaticFactory { @Autowired public void setDataSource(DataSource dataSource) { StaticFactory.dataSource = dataSource; } private static DataSource dataSource; }
标签:TestUtil,star,变量,静态,Component,dataSource,注解,public From: https://www.cnblogs.com/qtfwax/p/17172802.html