package com.colobu.spring;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Service
public class HelloService {
@Value("${app.count}")
private int num;
@Value("${app.name1:abcd}")
private String name1;
@Value("${app.name2:`abcd`}")
private String name2;
@Value("${app.name3}")
private String name3;
@Value("${app.enable}")
private boolean appEnable;
@Value("${app.name4:}")
private String name4;
@Value("${app.name5:''}")
private String name5;
@Value("${app.name6:@null}")
private String name6;
@Value("${app.name7:#{null}}")
private String name7;
@PostConstruct
public void start() {
System.out.println("start");
}
public void test(){
System.out.println("num=" + num);
System.out.println("appEnable=" + appEnable);
System.out.println("name1=" + name1);
System.out.println("name2=" + name2);
System.out.println("name3 =" + name3);
System.out.println("name4 =" + name4);
System.out.println("name5 = " + name5);
System.out.println("name6 = " + name6);
System.out.println("name7 = " + name7);
}
@PreDestroy
public void stop(){
System.out.println("stop");
}
}