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 | 13 | <parent> |
14 | 14 | <groupId>org.springframework.boot</groupId> |
15 | 15 | <artifactId>spring-boot-starter-parent</artifactId> |
16 | - <version>1.2.4.RELEASE</version> | |
16 | + <version>1.5.3.RELEASE</version> | |
17 | 17 | <relativePath/> |
18 | 18 | </parent> |
19 | 19 | |
... | ... | @@ -36,6 +36,10 @@ |
36 | 36 | <groupId>org.springframework.boot</groupId> |
37 | 37 | <artifactId>spring-boot-starter-web</artifactId> |
38 | 38 | </dependency> |
39 | + <!--dependency> | |
40 | + <groupId>org.springframework.boot</groupId> | |
41 | + <artifactId>spring-boot-starter-security</artifactId> | |
42 | + </dependency--> | |
39 | 43 | <dependency> |
40 | 44 | <groupId>org.springframework.boot</groupId> |
41 | 45 | <artifactId>spring-boot-starter-tomcat</artifactId> | ... | ... |
src/main/java/fr/plil/sio/web/mvc/Application.java
1 | 1 | package fr.plil.sio.web.mvc; |
2 | 2 | |
3 | 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 | 9 | public static void main(String[] args) { |
18 | 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 | 3 | |
4 | 4 | import org.slf4j.Logger; |
5 | 5 | import org.slf4j.LoggerFactory; |
6 | +import org.springframework.boot.SpringBootConfiguration; | |
6 | 7 | import org.springframework.context.annotation.Bean; |
7 | -import org.springframework.context.annotation.Configuration; | |
8 | 8 | import org.springframework.context.annotation.Scope; |
9 | 9 | import org.springframework.context.annotation.ScopedProxyMode; |
10 | 10 | import org.springframework.web.context.WebApplicationContext; |
11 | -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | |
12 | 11 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
13 | 12 | |
14 | -@Configuration | |
13 | +@SpringBootConfiguration | |
15 | 14 | public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { |
16 | 15 | |
17 | 16 | private static final Logger logger = LoggerFactory.getLogger(ApplicationMvcConfiguration.class); |
... | ... | @@ -23,6 +22,7 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { |
23 | 22 | return new UserSession(); |
24 | 23 | } |
25 | 24 | |
25 | +/* | |
26 | 26 | @Bean |
27 | 27 | public CheckUserInterceptor checkUserInterceptor() { |
28 | 28 | return new CheckUserInterceptor(); |
... | ... | @@ -34,4 +34,5 @@ public class ApplicationMvcConfiguration extends WebMvcConfigurerAdapter { |
34 | 34 | interceptor.setUserSession(userSession()); |
35 | 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 | 2 | |
3 | 3 | import org.junit.Test; |
4 | 4 | import org.junit.runner.RunWith; |
5 | -import org.springframework.boot.test.SpringApplicationConfiguration; | |
5 | +import org.springframework.boot.test.context.SpringBootTest; | |
6 | 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
7 | -import org.springframework.test.context.transaction.TransactionConfiguration; | |
8 | 7 | import org.springframework.transaction.annotation.Transactional; |
9 | 8 | |
10 | 9 | import javax.annotation.Resource; |
... | ... | @@ -13,9 +12,8 @@ import static org.junit.Assert.assertEquals; |
13 | 12 | import static org.junit.Assert.assertNotNull; |
14 | 13 | |
15 | 14 | @RunWith(SpringJUnit4ClassRunner.class) |
16 | -@SpringApplicationConfiguration(classes = Application.class) | |
15 | +@SpringBootTest(classes = Application.class) | |
17 | 16 | @Transactional |
18 | -@TransactionConfiguration | |
19 | 17 | public class UserRepositoryTest { |
20 | 18 | |
21 | 19 | @Resource | ... | ... |
src/test/java/fr/plil/sio/web/mvc/UserServiceTest.java
... | ... | @@ -2,9 +2,8 @@ package fr.plil.sio.web.mvc; |
2 | 2 | |
3 | 3 | import org.junit.Test; |
4 | 4 | import org.junit.runner.RunWith; |
5 | -import org.springframework.boot.test.SpringApplicationConfiguration; | |
5 | +import org.springframework.boot.test.context.SpringBootTest; | |
6 | 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
7 | -import org.springframework.test.context.transaction.TransactionConfiguration; | |
8 | 7 | import org.springframework.transaction.annotation.Transactional; |
9 | 8 | |
10 | 9 | import javax.annotation.Resource; |
... | ... | @@ -12,9 +11,8 @@ import javax.annotation.Resource; |
12 | 11 | import static org.junit.Assert.assertEquals; |
13 | 12 | |
14 | 13 | @RunWith(SpringJUnit4ClassRunner.class) |
15 | -@SpringApplicationConfiguration(classes = Application.class) | |
14 | +@SpringBootTest(classes = Application.class) | |
16 | 15 | @Transactional |
17 | -@TransactionConfiguration | |
18 | 16 | public class UserServiceTest { |
19 | 17 | |
20 | 18 | @Resource | ... | ... |
src/test/java/fr/plil/sio/web/mvc/ViewUsersControllerTest.java
... | ... | @@ -3,7 +3,7 @@ package fr.plil.sio.web.mvc; |
3 | 3 | import org.junit.Before; |
4 | 4 | import org.junit.Test; |
5 | 5 | import org.junit.runner.RunWith; |
6 | -import org.springframework.boot.test.SpringApplicationConfiguration; | |
6 | +import org.springframework.boot.test.context.SpringBootTest; | |
7 | 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
8 | 8 | import org.springframework.test.context.web.WebAppConfiguration; |
9 | 9 | import org.springframework.test.web.servlet.MockMvc; |
... | ... | @@ -18,7 +18,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder |
18 | 18 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
19 | 19 | |
20 | 20 | @RunWith(SpringJUnit4ClassRunner.class) |
21 | -@SpringApplicationConfiguration(classes = Application.class) | |
21 | +@SpringBootTest(classes = Application.class) | |
22 | 22 | @WebAppConfiguration |
23 | 23 | public class ViewUsersControllerTest { |
24 | 24 | ... | ... |