Commit 4283f0440f58418b9a1f9fc8107d31a45cdb2428
1 parent
2c4d3434
spring admin
Showing
4 changed files
with
40 additions
and
36 deletions
zteits-job/pom.xml
| ... | ... | @@ -163,6 +163,15 @@ |
| 163 | 163 | <groupId>org.springframework.security</groupId> |
| 164 | 164 | <artifactId>spring-security-web</artifactId> |
| 165 | 165 | </dependency> |
| 166 | + <dependency> | |
| 167 | + <groupId>de.codecentric</groupId> | |
| 168 | + <artifactId>spring-boot-admin-starter-client</artifactId> | |
| 169 | + <version>2.0.3</version> | |
| 170 | + </dependency> | |
| 171 | + <dependency> | |
| 172 | + <groupId>org.springframework.boot</groupId> | |
| 173 | + <artifactId>spring-boot-starter-security</artifactId> | |
| 174 | + </dependency> | |
| 166 | 175 | </dependencies> |
| 167 | 176 | |
| 168 | 177 | <build> | ... | ... |
zteits-job/src/main/java/com/zteits/job/JobApplication.java
| ... | ... | @@ -7,8 +7,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 7 | 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 8 | 8 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| 9 | 9 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| 10 | +import org.springframework.context.annotation.Configuration; | |
| 10 | 11 | import org.springframework.scheduling.annotation.EnableAsync; |
| 11 | 12 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 13 | +import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
| 14 | +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
| 12 | 15 | |
| 13 | 16 | @EnableScheduling |
| 14 | 17 | @EnableAsync |
| ... | ... | @@ -17,6 +20,14 @@ import org.springframework.scheduling.annotation.EnableScheduling; |
| 17 | 20 | @EnableAutoConfiguration |
| 18 | 21 | public class JobApplication extends SpringBootServletInitializer { |
| 19 | 22 | |
| 23 | + @Configuration | |
| 24 | + public static class SecurityPermitAllConfig extends WebSecurityConfigurerAdapter { | |
| 25 | + @Override | |
| 26 | + protected void configure(HttpSecurity http) throws Exception { | |
| 27 | + http.authorizeRequests().anyRequest().permitAll() | |
| 28 | + .and().csrf().disable(); | |
| 29 | + } | |
| 30 | + } | |
| 20 | 31 | @Override |
| 21 | 32 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
| 22 | 33 | return application.sources(JobApplication.class); | ... | ... |
zteits-job/src/main/java/com/zteits/job/config/session/HttpSessionConfig.java deleted
| 1 | -//package com.zteits.job.config.session; | |
| 2 | -// | |
| 3 | -//import org.springframework.context.annotation.Bean; | |
| 4 | -//import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; | |
| 5 | -//import org.springframework.session.web.http.HeaderHttpSessionStrategy; | |
| 6 | -//import org.springframework.session.web.http.HttpSessionStrategy; | |
| 7 | -// | |
| 8 | -///** | |
| 9 | -// * Copyright: Copyright (c) 2017 zteits | |
| 10 | -// * | |
| 11 | -// * @ClassName: com.zteits.oauth.portal.config.session | |
| 12 | -// * @Description: | |
| 13 | -// * @version: v1.0.0 | |
| 14 | -// * @author: atao | |
| 15 | -// * @date: 2017/5/16 下午9:23 | |
| 16 | -// * Modification History: | |
| 17 | -// * Date Author Version Description | |
| 18 | -// * ---------------------------------------------------------* | |
| 19 | -// * 2017/5/16 atao v1.0.0 创建 | |
| 20 | -// */ | |
| 21 | -////maxInactiveIntervalInSeconds | |
| 22 | -//@EnableRedisHttpSession(maxInactiveIntervalInSeconds=30*24*60*60) | |
| 23 | -//public class HttpSessionConfig { | |
| 24 | -// | |
| 25 | -// @Bean | |
| 26 | -// public HttpSessionStrategy httpSessionStrategy() { | |
| 27 | -// return new HeaderHttpSessionStrategy(); | |
| 28 | -// } | |
| 29 | -// | |
| 30 | -//} |
zteits-job/src/main/resources/application.properties
| ... | ... | @@ -2,12 +2,18 @@ spring.application.name=zteist-job |
| 2 | 2 | server.port=8080 |
| 3 | 3 | project.syscode=zteits-job |
| 4 | 4 | #spring.profiles.active=prod |
| 5 | +#logging.level.root=info | |
| 6 | +#logging.level.com.zteits=debug | |
| 7 | +#logging.level.com.zteits.job.mapper=error | |
| 8 | +#logging.level.org.springframework=error | |
| 9 | +#logging.path=./logs/${spring.application.name} | |
| 10 | +#logging.file=${spring.application.name}.log | |
| 11 | + | |
| 12 | +#logback-spring.xml | |
| 5 | 13 | logging.level.root=info |
| 6 | -logging.level.com.zteits=debug | |
| 7 | -logging.level.com.zteits.job.mapper=error | |
| 8 | -logging.level.org.springframework=error | |
| 9 | 14 | logging.path=./logs/${spring.application.name} |
| 10 | -logging.file=${spring.application.name}.log | |
| 15 | +logging.file=${logging.path}/${spring.application.name}.log | |
| 16 | +logging.config=classpath:logback-spring.xml | |
| 11 | 17 | |
| 12 | 18 | #park-datasource |
| 13 | 19 | park-datasource.driverClassName=com.mysql.jdbc.Driver |
| ... | ... | @@ -42,9 +48,17 @@ spring.session.store-type=redis |
| 42 | 48 | |
| 43 | 49 | ƒ |
| 44 | 50 | #spring.boot.admin.client.url=http://192.168.1.196:8080 |
| 45 | -spring.boot.admin.client.url=http://localhost:8080 | |
| 46 | -spring.boot.admin.client.prefer-ip=true | |
| 51 | +#spring.boot.admin.client.url=http://localhost:8080 | |
| 52 | +#spring.boot.admin.client.prefer-ip=true | |
| 53 | +#management.endpoints.web.exposure.include=* | |
| 54 | + | |
| 55 | +#196\u73AF\u5883 | |
| 56 | +spring.boot.admin.client.url=http://192.168.1.196:8080 | |
| 57 | +#spring.boot.admin.client.url=http://localhost:8080 | |
| 58 | +spring.boot.admin.client.instance.prefer-ip=true | |
| 47 | 59 | management.endpoints.web.exposure.include=* |
| 60 | +spring.boot.admin.client.username=zteits-admin | |
| 61 | +spring.boot.admin.client.password=ZTE1zte1 | |
| 48 | 62 | |
| 49 | 63 | #spring.datasource.initialize=false |
| 50 | 64 | spring.datasource.initialization-mode=never | ... | ... |