spring webflux项目启动类
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.server.EnableRedisWebSession;
import org.springframework.web.reactive.config.EnableWebFlux;
@Slf4j
@SpringBootApplication
@EnableWebFlux
@EnableScheduling
@EnableRetry
@EnableRedisWebSession(maxInactiveIntervalInSeconds = 60*60*2, redisNamespace="user:login:seession:") // 支持流式代码的用户登录session
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
application.properties配置:
server.port=8095
server.servlet.context-path=/my-service
spring.application.name=my-service
spring.main.web-application-type=reactive
spring.main.allow-bean-definition-overriding=true
management.endpoint.health.show-details=always
spring.profiles.active=
# 包含这些额外的properties文件:application-cron.properties; application-redis.properties; application-rabbitmq.properties;
spring.profiles.include=cron,redis,rabbitmq
end.