Spring boot starter actuator to use advanced features

Info icon This preview shows pages 141–156. Sign up to view the full content.

spring-boot-starter-actuator - To use advanced features like monitoring & tracing to your application out of the box spring-boot-starter-undertow, spring-boot-starter- jetty, spring-boot-starter-tomcat - To pick your specific choice of Embedded Servlet Container spring-boot-starter-logging - For Logging using logback spring-boot-starter-log4j2 - Logging using Log4j2
Image of page 141

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Questions What is Starter Parent? What are the different things that are defined in Starter Parent? How does Spring Boot enforce common dependency management for all its Starter projects?
Image of page 142
Starter Parent <parent> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-starter-parent </artifactId> <version> 2.0.0.RELEASE </version> </parent>
Image of page 143

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Inside Starter Parent <parent> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-dependencies </artifactId> <version> 2.0.0.RELEASE </version> <relativePath> ../../spring-boot-dependencies </relativePath> </parent> <java.version> 1.6 </java.version> <resource.delimiter> @ </resource.delimiter> <!-- delimiter that <project.build.sourceEncoding> UTF-8 </project.build.sourceEncod <project.reporting.outputEncoding> UTF-8 </project.reporting.out <maven.compiler.source> ${java.version} </maven.compiler.source> <maven.compiler.target> ${java.version} </maven.compiler.target>
Image of page 144
Inside Spring Boot Dependencies <ehcache3.version> 3.1.1 </ehcache3.version> ... <h2.version> 1.4.192 </h2.version> <hamcrest.version> 1.3 </hamcrest.version> <hazelcast.version> 3.6.4 </hazelcast.version> <hibernate.version> 5.0.9.Final </hibernate.version> <hibernate-validator.version> 5.2.4.Final </hibernate-validator. <jackson.version> 2.8.1 </jackson.version> .... <jersey.version> 2.23.1 </jersey.version> <spring-security.version> 4.1.1.RELEASE </spring-security.versio <tomcat.version> 8.5.4 </tomcat.version> <xml-apis.version> 1.4.01 </xml-apis.version>
Image of page 145

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Questions What is Spring Initializr?
Image of page 146
Spring Initializr is great tool to bootstrap your Spring Boot projects.
Image of page 147

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Questions What is application.properties? What are some of the important things that can customized in application.properties?
Image of page 148
application.properties is used to configure your Spring Boot Application
Image of page 149

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Example Configuration logging.file= logging.level.*= spring.autoconfigure.exclude= spring.profiles.active= server.error.path=/error server.port=8080 spring.http.converters.preferred-json-mapper=jackson
Image of page 150
Questions How do you externalize configuration using Spring Boot? How can you add custom application properties using Spring Boot? What is @ConfigurationProperties?
Image of page 151

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

logging: level: org.springframework: DEBUG app: name : In28Minutes description: ${app. name } is your first Spring Boot applicat
Image of page 152
import org.springframework.boot.context.properties.ConfigurationProp @Component @ConfigurationProperties ( "basic" ) public class BasicConfiguration { private boolean value; private String message; private int number;
Image of page 153

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

@Autowired private BasicConfiguration configuration; @RequestMapping ( "/dynamic-configuration" ) public Map dynamicConfiguration () { // Not the best practice to use a map to store differnt ty Map map = new HashMap(); map.put( "message" , configuration.getMessage()); map.put( "number" , configuration.getNumber()); map.put( "key" , configuration.isValue()); return map; }
Image of page 154
application.properties
Image of page 155

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 156
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '18
  • LN Rao
  • public class, Spring Framework, Spring Boot, Spring Security

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern