Commit 88ff471f5792c8865d6a3fe60d0bbdc7ddd5d334
1 parent
3c085ac4
Switching to spring boot 1.5.3
Showing
6 changed files
with
18 additions
and
30 deletions
Show diff stats
pom.xml
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | <parent> | 13 | <parent> |
14 | <groupId>org.springframework.boot</groupId> | 14 | <groupId>org.springframework.boot</groupId> |
15 | <artifactId>spring-boot-starter-parent</artifactId> | 15 | <artifactId>spring-boot-starter-parent</artifactId> |
16 | - <version>1.2.4.RELEASE</version> | 16 | + <version>1.5.3.RELEASE</version> |
17 | <relativePath/> | 17 | <relativePath/> |
18 | </parent> | 18 | </parent> |
19 | 19 | ||
@@ -36,6 +36,10 @@ | @@ -36,6 +36,10 @@ | ||
36 | <groupId>org.springframework.boot</groupId> | 36 | <groupId>org.springframework.boot</groupId> |
37 | <artifactId>spring-boot-starter-web</artifactId> | 37 | <artifactId>spring-boot-starter-web</artifactId> |
38 | </dependency> | 38 | </dependency> |
39 | + <!--dependency> | ||
40 | + <groupId>org.springframework.boot</groupId> | ||
41 | + <artifactId>spring-boot-starter-security</artifactId> | ||
42 | + </dependency--> | ||
39 | <dependency> | 43 | <dependency> |
40 | <groupId>org.springframework.boot</groupId> | 44 | <groupId>org.springframework.boot</groupId> |
41 | <artifactId>spring-boot-starter-tomcat</artifactId> | 45 | <artifactId>spring-boot-starter-tomcat</artifactId> |
src/main/java/fr/plil/sio/web/mvc/Application.java
1 | package fr.plil.sio.web.mvc; | 1 | package fr.plil.sio.web.mvc; |
2 | 2 | ||
3 | import org.springframework.boot.SpringApplication; | 3 | import org.springframework.boot.SpringApplication; |
4 | -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
5 | -import org.springframework.boot.builder.SpringApplicationBuilder; | ||
6 | -import org.springframework.boot.context.web.SpringBootServletInitializer; | ||
7 | -import org.springframework.context.annotation.ComponentScan; | ||
8 | -import org.springframework.context.annotation.Configuration; | ||
9 | -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | 4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; |
10 | 5 | ||
11 | -@EnableAutoConfiguration | ||
12 | -@Configuration | ||
13 | -@ComponentScan | ||
14 | -@EnableJpaRepositories | ||
15 | -public class Application extends SpringBootServletInitializer { | ||
16 | 6 | ||
7 | +@SpringBootApplication | ||
8 | +public class Application { | ||
17 | public static void main(String[] args) { | 9 | public static void main(String[] args) { |
18 | SpringApplication.run(Application.class, args); | 10 | SpringApplication.run(Application.class, args); |
19 | } | 11 | } |
20 | - | ||
21 | - @Override | ||
22 | - protected final SpringApplicationBuilder configure(final SpringApplicationBuilder application) { | ||
23 | - return application.sources(Application.class); | ||
24 | - } | ||
25 | } | 12 | } |
src/main/java/fr/plil/sio/web/mvc/ApplicationMvcConfiguration.java
@@ -3,15 +3,14 @@ package fr.plil.sio.web.mvc; | @@ -3,15 +3,14 @@ package fr.plil.sio.web.mvc; | ||
3 | 3 | ||
4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
6 | +import org.springframework.boot.SpringBootConfiguration; | ||
6 | import org.springframework.context.annotation.Bean; | 7 | import org.springframework.context.annotation.Bean; |
7 | -import org.springframework.context.annotation.Configuration; | ||
8 | import org.springframework.context.annotation.Scope; | 8 | import org.springframework.context.annotation.Scope; |
9 | import org.springframework.context.annotation.ScopedProxyMode; | 9 | import org.springframework.context.annotation.ScopedProxyMode; |
10 | import org.springframework.web.context.WebApplicationContext; | 10 | import org.springframework.web.context.WebApplicationContext; |
11 | -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
12 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | 11 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
13 | 12 | ||
14 | -@Configuration | 13 | +@SpringBootConfiguration |
15 | public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { | 14 | public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { |
16 | 15 | ||
17 | private static final Logger logger = LoggerFactory.getLogger(ApplicationMvcConfiguration.class); | 16 | private static final Logger logger = LoggerFactory.getLogger(ApplicationMvcConfiguration.class); |
@@ -23,6 +22,7 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { | @@ -23,6 +22,7 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { | ||
23 | return new UserSession(); | 22 | return new UserSession(); |
24 | } | 23 | } |
25 | 24 | ||
25 | +/* | ||
26 | @Bean | 26 | @Bean |
27 | public CheckUserInterceptor checkUserInterceptor() { | 27 | public CheckUserInterceptor checkUserInterceptor() { |
28 | return new CheckUserInterceptor(); | 28 | return new CheckUserInterceptor(); |
@@ -34,4 +34,5 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { | @@ -34,4 +34,5 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { | ||
34 | interceptor.setUserSession(userSession()); | 34 | interceptor.setUserSession(userSession()); |
35 | registry.addInterceptor(interceptor); | 35 | registry.addInterceptor(interceptor); |
36 | } | 36 | } |
37 | +*/ | ||
37 | } | 38 | } |
src/test/java/fr/plil/sio/web/mvc/UserRepositoryTest.java
@@ -2,9 +2,8 @@ package fr.plil.sio.web.mvc; | @@ -2,9 +2,8 @@ package fr.plil.sio.web.mvc; | ||
2 | 2 | ||
3 | import org.junit.Test; | 3 | import org.junit.Test; |
4 | import org.junit.runner.RunWith; | 4 | import org.junit.runner.RunWith; |
5 | -import org.springframework.boot.test.SpringApplicationConfiguration; | 5 | +import org.springframework.boot.test.context.SpringBootTest; |
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
7 | -import org.springframework.test.context.transaction.TransactionConfiguration; | ||
8 | import org.springframework.transaction.annotation.Transactional; | 7 | import org.springframework.transaction.annotation.Transactional; |
9 | 8 | ||
10 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
@@ -13,9 +12,8 @@ import static org.junit.Assert.assertEquals; | @@ -13,9 +12,8 @@ import static org.junit.Assert.assertEquals; | ||
13 | import static org.junit.Assert.assertNotNull; | 12 | import static org.junit.Assert.assertNotNull; |
14 | 13 | ||
15 | @RunWith(SpringJUnit4ClassRunner.class) | 14 | @RunWith(SpringJUnit4ClassRunner.class) |
16 | -@SpringApplicationConfiguration(classes = Application.class) | 15 | +@SpringBootTest(classes = Application.class) |
17 | @Transactional | 16 | @Transactional |
18 | -@TransactionConfiguration | ||
19 | public class UserRepositoryTest { | 17 | public class UserRepositoryTest { |
20 | 18 | ||
21 | @Resource | 19 | @Resource |
src/test/java/fr/plil/sio/web/mvc/UserServiceTest.java
@@ -2,9 +2,8 @@ package fr.plil.sio.web.mvc; | @@ -2,9 +2,8 @@ package fr.plil.sio.web.mvc; | ||
2 | 2 | ||
3 | import org.junit.Test; | 3 | import org.junit.Test; |
4 | import org.junit.runner.RunWith; | 4 | import org.junit.runner.RunWith; |
5 | -import org.springframework.boot.test.SpringApplicationConfiguration; | 5 | +import org.springframework.boot.test.context.SpringBootTest; |
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
7 | -import org.springframework.test.context.transaction.TransactionConfiguration; | ||
8 | import org.springframework.transaction.annotation.Transactional; | 7 | import org.springframework.transaction.annotation.Transactional; |
9 | 8 | ||
10 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
@@ -12,9 +11,8 @@ import javax.annotation.Resource; | @@ -12,9 +11,8 @@ import javax.annotation.Resource; | ||
12 | import static org.junit.Assert.assertEquals; | 11 | import static org.junit.Assert.assertEquals; |
13 | 12 | ||
14 | @RunWith(SpringJUnit4ClassRunner.class) | 13 | @RunWith(SpringJUnit4ClassRunner.class) |
15 | -@SpringApplicationConfiguration(classes = Application.class) | 14 | +@SpringBootTest(classes = Application.class) |
16 | @Transactional | 15 | @Transactional |
17 | -@TransactionConfiguration | ||
18 | public class UserServiceTest { | 16 | public class UserServiceTest { |
19 | 17 | ||
20 | @Resource | 18 | @Resource |
src/test/java/fr/plil/sio/web/mvc/ViewUsersControllerTest.java
@@ -3,7 +3,7 @@ package fr.plil.sio.web.mvc; | @@ -3,7 +3,7 @@ package fr.plil.sio.web.mvc; | ||
3 | import org.junit.Before; | 3 | import org.junit.Before; |
4 | import org.junit.Test; | 4 | import org.junit.Test; |
5 | import org.junit.runner.RunWith; | 5 | import org.junit.runner.RunWith; |
6 | -import org.springframework.boot.test.SpringApplicationConfiguration; | 6 | +import org.springframework.boot.test.context.SpringBootTest; |
7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
8 | import org.springframework.test.context.web.WebAppConfiguration; | 8 | import org.springframework.test.context.web.WebAppConfiguration; |
9 | import org.springframework.test.web.servlet.MockMvc; | 9 | import org.springframework.test.web.servlet.MockMvc; |
@@ -18,7 +18,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder | @@ -18,7 +18,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder | ||
18 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; | 18 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
19 | 19 | ||
20 | @RunWith(SpringJUnit4ClassRunner.class) | 20 | @RunWith(SpringJUnit4ClassRunner.class) |
21 | -@SpringApplicationConfiguration(classes = Application.class) | 21 | +@SpringBootTest(classes = Application.class) |
22 | @WebAppConfiguration | 22 | @WebAppConfiguration |
23 | public class ViewUsersControllerTest { | 23 | public class ViewUsersControllerTest { |
24 | 24 |