mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-28 06:09:37 +00:00
#164 Set Dandelion active profile to "prod" when Spring production profile is enabled
This commit is contained in:
parent
4da41dbbda
commit
1f42b7615d
1 changed files with 15 additions and 0 deletions
|
@ -19,11 +19,16 @@ package org.springframework.samples.petclinic.config;
|
|||
import com.github.dandelion.core.web.DandelionFilter;
|
||||
import com.github.dandelion.core.web.DandelionServlet;
|
||||
import com.github.dandelion.datatables.core.web.filter.DatatablesFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.embedded.FilterRegistrationBean;
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Description;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* Java configuration for the Dandelion datatables component.
|
||||
|
@ -33,6 +38,16 @@ import org.springframework.context.annotation.Description;
|
|||
@Configuration
|
||||
public class DandelionConfig {
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (environment.acceptsProfiles("production")) {
|
||||
System.setProperty("dandelion.profile.active", "prod");
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Description("Dandelion filter definition and mapping")
|
||||
public FilterRegistrationBean filterRegistrationBean() {
|
||||
|
|
Loading…
Reference in a new issue