Professional Documents
Culture Documents
Z Petclinic-Documentation PDF
Z Petclinic-Documentation PDF
Spring
Petclinic
• h/ps://github.com/SpringSource/spring-‐petclinic
• h/p://spring-‐petclinic.cloudfoundry.com/
JSP
with
Views custom
tags
|| Thymeleaf
@Cacheable
Service
@TransacGonal
• Core
Spring
• The
Web
layer
Data
Access
VisitRepository
@ContextConfiguration(locations = …) <context-param>
@RunWith(SpringJUnit4ClassRunner.class) <param-name>
spring.profiles.active
@ActiveProfiles("jdbc") </param-name>
public class JdbcOwnerRepositoryTests <param-value>
…{} jdbc
</param-value>
</context-param>
ClinicServiceImpl ehcache.xml
tools-config.xml
ExcepGon
Handling
Declared in mvc-core-config.xml
SimpleMapping
Based on the configuration used in petclinic:
ExcepGonResolver
• Logs the exception stacktrace
• Forwards to WEB-INF/jsp/exception.jsp
• Exception logged as a comment inside exception.jsp
• How
to
add
behavior
in
all
methods
of
all
Repository
classes?
JpaOwnerRepository
JpaVisitRepository
Aspect
Oriented
Programming
(2/2)
• CallMonitoringAspect
@Aspect
public class CallMonitoringAspect {
@Around("within(@org.springframework.stereotype.Repository *)")
public Object invoke(…) { … } }
@Repository @Repository
public class public class
JpaVetRepositoryImpl
…
JpaVisitRepositoryImpl
• Core
Spring
• The
Web
layer
– Spring
MVC
– Third-‐party
web
libraries
View
Resolvers
in
spring-‐petclinic
mvc-view-config.xml
vets.html
vets.xml
owners.html pets/9/visits.atom
InternalResourceVR BeanNameVR
12
Topics
• Core
Spring
• The
Web
layer
– Spring
MVC
– Third-‐party
web
libraries
• Dandelion
for
datatables
• Webjars
Datatables in Spring MVC
JSP file
14
Dandelion is based on
jQuery Datatables and Bootstrap
• Core
Spring
• The
Web
layer
– Spring
MVC
– Third-‐party
web
libraries
• Dandelion
• WebJars
Webjars
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery-ui</artifactId>
<version>1.9.1</version>
</dependency>
pom.xml
Using Webjars
• Inside JSP
• Series
of
5
blog
entries
from
Julien
Dubois
on
how
to
“improve
performance
of
the
Spring-‐Petclinic
applicaGon”
– h/p://blog.ippon.fr/2013/03/11/
• Dandelion:
clickable/sortable
datatatables
inside
Spring-‐
Petclinic
– h/p://dandelion.github.io/blog/2013/04/24/IntegraGng-‐Dandelion-‐
DataTables-‐in-‐the-‐Spring-‐Petclinic-‐app
20