Created
December 29, 2022 18:46
-
-
Save KupchenkoArtur/0b48d8523b74aff3cf0b03232a2f4aec to your computer and use it in GitHub Desktop.
1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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