提交 365ba64a 编写于 作者: 武汉红喜's avatar 武汉红喜

optimise

上级 9fc1e6b9
......@@ -4,12 +4,11 @@ import org.hongxi.whatsmars.kafka.spring.config.KafkaConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.kafka.core.KafkaTemplate;
public class Main {
public class Application {
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(KafkaConfiguration.class);
context.scan("org.hongxi.whatsmars.kafka.spring.consumer");
context.scan(Application.class.getPackage().getName());
context.refresh();
KafkaTemplate<String, String> kafkaTemplate = context.getBean(KafkaTemplate.class);
......
......@@ -11,7 +11,7 @@ public class Application {
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.scan("org.hongxi.whatsmars.spring.data");
context.scan(Application.class.getPackage().getName());
context.getEnvironment().setActiveProfiles(ProfileUtils.getProfile());
context.refresh();
}
......
......@@ -7,8 +7,7 @@ public class TestSpring {
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
// context.register(PropertyConfiguration.class);
context.scan("org.hongxi.whatsmars.spring.profile");
context.scan(TestSpring.class.getPackage().getName());
context.getEnvironment().setActiveProfiles(ProfileUtils.getProfile());
context.refresh();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册