Skip to content

Instantly share code, notes, and snippets.

@KupchenkoArtur
Created December 29, 2022 18:46
Show Gist options
  • Save KupchenkoArtur/0b48d8523b74aff3cf0b03232a2f4aec to your computer and use it in GitHub Desktop.
Save KupchenkoArtur/0b48d8523b74aff3cf0b03232a2f4aec to your computer and use it in GitHub Desktop.
1
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
@Configuration
public class AppConfig {
@Bean(name = "helloworld")
public HelloWorld getHelloWorld() {
HelloWorld helloWorld = new HelloWorld();
helloWorld.setMessage("Hello World!");
return helloWorld;
}
@Bean(name = "cat")
@Scope("prototype")
public Cat getCat() {
Cat cat = new Cat();
cat.setMessage("Meow");
return cat;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment