|
|
@@ -5,18 +5,20 @@ import com.alibaba.nacos.api.config.annotation.NacosValue; |
|
|
|
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource; |
|
|
|
import org.springframework.boot.SpringApplication; |
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
|
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
|
|
|
import org.springframework.context.ConfigurableApplicationContext; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
@SpringBootApplication |
|
|
|
|
|
|
|
@NacosPropertySource(dataId = "springboot2-nacos-config", autoRefreshed = true) |
|
|
|
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) |
|
|
|
@RestController |
|
|
|
public class Test{ |
|
|
|
public class Test1{ |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
try { |
|
|
|
ConfigurableApplicationContext context = SpringApplication.run(Test.class, args); |
|
|
|
ConfigurableApplicationContext context = SpringApplication.run(Test1.class, args); |
|
|
|
System.out.print(context.getEnvironment().getProperty("nacos.test.propertie")); |
|
|
|
|
|
|
|
}catch(Exception e) { |