Mindmap
Spring configuration
Inhalt der Mindmap
Spring configuration
To obtain Environment variables
- You can Inject Environment with @Autowired
- and call environment.getProperty("PROP_NAME")
- You can use @Value annotation
- can be use in fields or methos parameters
- @Value("${environmentName}")
- You can Inject Environment with @Autowired
@Profile
- Method
- Class
- Multiples profiles can be active
- is equivalent to profile attribute on <beans> tag, <beans> tags can be nested
- Profile attribute not work on tag <bean>
@Configuration
- Defines a configuration class
- Are subclassed at startup-time with CGLIB
- Configuration class should not be final
- You can use @Import
- To split @Configurations in multiples class
- @PropertySource
- Additional property sources
- @Configuration @PropertySource("classpath:/com/exampleconfig/application.properties") public class ApplicationConfiguration {
- Can be mixed with @ComponentScan
- But component scanning can work without @Configuration
- <context:component-scan base-package="br.com.softplan">
- But component scanning can work without @Configuration
Spring Expression language (SPEL)
- can be used in @Value annotation values
- ${} is for properties
- #{} is for SpEL
- Access property of bean #{beanName.property}
- systemProperties
- systemEnvironment
- Used in spring Security and batch
@EnableAutoConfguration
- Springboot automatically attempts to configure yout application based on the jar dependencies that you have added
- You should only ever add one @SpringBootApplication or @EnableAutoConfiguration annotation.
- in your main class with @Configuration
- You should only ever add one @SpringBootApplication or @EnableAutoConfiguration annotation.
- Springboot automatically attempts to configure yout application based on the jar dependencies that you have added
Informationen
- Beschreibung
- Mindmap am Spring configuration, erstellt von Felipe Malfatti am 16/04/2018.
- Erstellt von
- Felipe Malfatti
- Aufrufe
- 0
- Bewertung