Skip to content

Commit

Permalink
optimise
Browse files Browse the repository at this point in the history
  • Loading branch information
javahongxi committed Dec 5, 2019
1 parent 9fc1e6b commit 365ba64
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 365ba64

Please sign in to comment.