0% found this document useful (0 votes)
48 views

Notes - Spring Boot

Uploaded by

wedefoh932
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Notes - Spring Boot

Uploaded by

wedefoh932
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

@SpringBootApplication --> @SpringBootConfiguration + @EnableAutoConfiguration +

@ComponentScan

@SpringBootConfiguration -- specialized form of the @Configuration


@EnableAutoConfiguration -- Enables Spring Boot automatic configuration
@ComponentScan -- Enables component scanning

The main() method calls a static run() method on the SpringApplication class which
creates the Spring application context. The two parameters passed to the run()
method are a configuration class and the command-line arguments

Running the project :


$ ./mvnw package
...
$ java -jar target/taco-cloud-0.0.1-SNAPSHOT.jar

Or
./mvnw spring-boot:run

@SpringBootTest --> tells JUnit to bootstrap the test with Spring Boot capabilities

Running test : $ ./mvnw test

@WebMvcTest --> arranges for the test to run in the context of a Spring MVC
application.

@ModelAttribute --> Annotation that binds a method parameter or method return


value to a named model attribute, exposed to a web view

before Spring hands the request over to a view, it copies the model data into
request attributes that Thymeleaf and other view-templating options have ready
access to.

For implementing cross-cutting concerns.

Terminologies:
Advice:- the job of an aspect is called advice. defines both the what and the
when of an aspect
Before,After,After-returning,After-throwing,Around
Join Points :- points where your aspect’s code can be inserted into the
normal flow of
your application to add new behaviour. This point could be a method being
called, an exception being thrown, or even a field being modified
Point Cuts :- pointcut definition matches one or more join points at which
advice should be woven. If advice defines the what and when of aspects, then
pointcuts define the where.
Aspects :- merger of advice and pointcuts
Introductions :- allows you to add new methods or attributes to existing
classes
Weaving :- process of applying aspects to a target object to create a new
proxied
object. Can take place at Compile time, Class load time, Runtime

@Aspect Make a class as aspect


@Pointcut Define a marker method as pointcut so it can be reused
@EnableAspectJAutoProxy Enabling aspects

You might also like