diff --git a/pom.xml b/pom.xml index 938c442..758c5f2 100644 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,11 @@ commons-lang 2.6 - + + + com.zaxxer + HikariCP + org.sitemesh diff --git a/src/main/java/com/monkeyk/sos/service/impl/OauthServiceImpl.java b/src/main/java/com/monkeyk/sos/service/impl/OauthServiceImpl.java index 80077b4..1c6ad05 100644 --- a/src/main/java/com/monkeyk/sos/service/impl/OauthServiceImpl.java +++ b/src/main/java/com/monkeyk/sos/service/impl/OauthServiceImpl.java @@ -21,13 +21,13 @@ public class OauthServiceImpl implements OauthService { private OauthRepository oauthRepository; @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public OauthClientDetails loadOauthClientDetails(String clientId) { return oauthRepository.findOauthClientDetails(clientId); } @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public List loadAllOauthClientDetailsDtos() { List clientDetailses = oauthRepository.findAllOauthClientDetails(); return OauthClientDetailsDto.toDtos(clientDetailses); @@ -40,7 +40,7 @@ public class OauthServiceImpl implements OauthService { } @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public OauthClientDetailsDto loadOauthClientDetailsDto(String clientId) { final OauthClientDetails oauthClientDetails = oauthRepository.findOauthClientDetails(clientId); return oauthClientDetails != null ? new OauthClientDetailsDto(oauthClientDetails) : null; diff --git a/src/main/java/com/monkeyk/sos/service/impl/UserServiceImpl.java b/src/main/java/com/monkeyk/sos/service/impl/UserServiceImpl.java index eeb6aab..164457a 100644 --- a/src/main/java/com/monkeyk/sos/service/impl/UserServiceImpl.java +++ b/src/main/java/com/monkeyk/sos/service/impl/UserServiceImpl.java @@ -43,7 +43,7 @@ public class UserServiceImpl implements UserService { } @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public UserJsonDto loadCurrentUserJsonDto() { final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); final Object principal = authentication.getPrincipal(); @@ -58,7 +58,7 @@ public class UserServiceImpl implements UserService { } @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public UserOverviewDto loadUserOverviewDto(UserOverviewDto overviewDto) { List users = userRepository.findUsersByUsername(overviewDto.getUsername()); overviewDto.setUserDtos(UserDto.toDtos(users)); @@ -66,7 +66,7 @@ public class UserServiceImpl implements UserService { } @Override - @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) + @Transactional(readOnly = true) public boolean isExistedUsername(String username) { final User user = userRepository.findByUsername(username); return user != null; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 160157f..01654ab 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -6,8 +6,12 @@ spring.application.name=spring-oauth-server ##################### spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/oauth2_boot?autoReconnect=true&autoReconnectForPools=true&useUnicode=true&characterEncoding=utf8 -spring.datasource.data-username=andaily -spring.datasource.data-password=andaily +spring.datasource.username=andaily +spring.datasource.password=andaily +#Datasource properties +spring.datasource.type=com.zaxxer.hikari.HikariDataSource +spring.datasource.hikari.maximum-pool-size=20 +spring.datasource.hikari.minimum-idle=2 # # MVC spring.mvc.ignore-default-model-on-redirect=false diff --git a/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp b/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp index 949f15e..204ae68 100644 --- a/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp +++ b/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp @@ -11,7 +11,7 @@ 注册client - + @@ -28,7 +28,7 @@

- +
diff --git a/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp b/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp index 719c0aa..f2127d2 100644 --- a/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp +++ b/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp @@ -10,7 +10,7 @@ Test [${clientDetailsDto.clientId}] - + diff --git a/src/main/webapp/WEB-INF/jsp/decorators/main.jsp b/src/main/webapp/WEB-INF/jsp/decorators/main.jsp index c0d6984..6310993 100644 --- a/src/main/webapp/WEB-INF/jsp/decorators/main.jsp +++ b/src/main/webapp/WEB-INF/jsp/decorators/main.jsp @@ -3,7 +3,7 @@ * @author Shengzhao Li --%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib tagdir="/WEB-INF/tags" prefix="custom" %> diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp index 9aa5dd2..4a64c3d 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/WEB-INF/jsp/index.jsp @@ -16,9 +16,9 @@

Spring Security&OAuth2 is work!

- Login + Login  |  - Logout + Logout

diff --git a/src/main/webapp/WEB-INF/jsp/login.jsp b/src/main/webapp/WEB-INF/jsp/login.jsp index 566dc18..be2bffc 100644 --- a/src/main/webapp/WEB-INF/jsp/login.jsp +++ b/src/main/webapp/WEB-INF/jsp/login.jsp @@ -21,7 +21,7 @@
-
@@ -30,7 +30,7 @@
-
diff --git a/src/main/webapp/WEB-INF/jsp/unity/dashboard.jsp b/src/main/webapp/WEB-INF/jsp/unity/dashboard.jsp index bf1d844..3a8d54a 100644 --- a/src/main/webapp/WEB-INF/jsp/unity/dashboard.jsp +++ b/src/main/webapp/WEB-INF/jsp/unity/dashboard.jsp @@ -16,7 +16,7 @@ Principal: ${SPRING_SECURITY_CONTEXT.authentication.principal}
-Logout +Logout \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/user_form.jsp b/src/main/webapp/WEB-INF/jsp/user_form.jsp index c2aa467..203d69a 100644 --- a/src/main/webapp/WEB-INF/jsp/user_form.jsp +++ b/src/main/webapp/WEB-INF/jsp/user_form.jsp @@ -17,7 +17,7 @@

Add User

- +