Replacing XML with Java configuration

This commit is contained in:
Ioannis Diplas 2019-12-18 11:09:03 +00:00
parent bf0bdf50c1
commit 6edd5ffca7
13 changed files with 356 additions and 282 deletions

View File

@ -0,0 +1,179 @@
package eu.dnetlib.repo.manager.config;
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
import org.mitre.oauth2.model.RegisteredClient;
import org.mitre.openid.connect.client.OIDCAuthenticationFilter;
import org.mitre.openid.connect.client.OIDCAuthenticationProvider;
import org.mitre.openid.connect.client.service.impl.*;
import org.mitre.openid.connect.config.ServerConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Configuration
@EnableWebSecurity
public class AaiSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Value("${webapp.dev.front}")
private String logoutSuccessUrl;
@Value("${oidc.issuer}")
private String oidcIssuer;
@Value("${oidc.id}")
private String oidcId;
@Value("${oidc.secret}")
private String oidcSecret;
@Value("${oidc.dev.home}")
private String oidcDevHome;
@Value("${webapp.dev.front}")
private String webAppFrontEnd;
private Map<String, String> userRoles = new HashMap<String, String>(){{
put("urn:geant:openaire.eu:group:Super+Administrator#aai.openaire.eu", "ROLE_ADMIN");
put("urn:geant:openaire.eu:group:Content+Provider+Dashboard+Administrator#aai.openaire.eu","ROLE_PROVIDE_ADMIN");
}};
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return authenticationManager();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(openIdConnectAuthenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.anonymous().disable()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic()
.authenticationEntryPoint(authenticationEntryPoint())
.and()
.logout().logoutUrl("/openid_logout")
.invalidateHttpSession(true)
.deleteCookies("openAIRESession")
.logoutSuccessUrl(logoutSuccessUrl)
.and()
.addFilterBefore(openIdConnectAuthenticationFilter(), AbstractPreAuthenticatedProcessingFilter.class)
;
}
@Bean
public OIDCAuthenticationProvider openIdConnectAuthenticationProvider(){
OIDCAuthenticationProvider oidcProvider = new OIDCAuthenticationProvider();
oidcProvider.setAuthoritiesMapper(authoritiesMapper());
return oidcProvider;
}
@Bean
public OpenAireProviderAuthoritiesMapper authoritiesMapper(){
OpenAireProviderAuthoritiesMapper authoritiesMapper = new OpenAireProviderAuthoritiesMapper(userRoles);
return authoritiesMapper;
}
@Bean
public StaticServerConfigurationService staticServerConfigurationService(){
StaticServerConfigurationService staticServerConfigurationService = new StaticServerConfigurationService();
Map<String, ServerConfiguration> servers = new HashMap<>();
servers.put(oidcIssuer, serverConfiguration());
staticServerConfigurationService.setServers(servers);
return staticServerConfigurationService;
}
@Bean
public StaticClientConfigurationService staticClientConfigurationService(){
StaticClientConfigurationService staticClientConfigurationService = new StaticClientConfigurationService();
Map<String, RegisteredClient> clients = new HashMap<>();
clients.put(oidcIssuer,registeredClient());
staticClientConfigurationService.setClients(clients);
return staticClientConfigurationService;
}
@Bean
public RegisteredClient registeredClient(){
RegisteredClient registeredClient = new RegisteredClient();
registeredClient.setClientId(oidcId);
registeredClient.setClientSecret(oidcSecret);
registeredClient.setScope(new HashSet<>(Collections.singletonList("openid")));
registeredClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
registeredClient.setRedirectUris(new HashSet<>(Collections.singletonList(oidcDevHome)));
return registeredClient;
}
@Bean
public StaticAuthRequestOptionsService staticAuthRequestOptionsService(){
return new StaticAuthRequestOptionsService();
}
@Bean
public PlainAuthRequestUrlBuilder plainAuthRequestUrlBuilder(){
return new PlainAuthRequestUrlBuilder();
}
@Bean
public ServerConfiguration serverConfiguration(){
ServerConfiguration serverConfiguration = new ServerConfiguration();
serverConfiguration.setIssuer(oidcIssuer);
serverConfiguration.setAuthorizationEndpointUri(oidcIssuer+"authorize");
serverConfiguration.setTokenEndpointUri(oidcIssuer+"token");
serverConfiguration.setUserInfoUri(oidcIssuer+"userinfo");
serverConfiguration.setJwksUri(oidcIssuer+"jwk");
serverConfiguration.setRevocationEndpointUri(oidcIssuer+"revoke");
return serverConfiguration;
}
@Bean
public LoginUrlAuthenticationEntryPoint authenticationEntryPoint(){
return new LoginUrlAuthenticationEntryPoint("/openid_connect_login");
}
@Bean
public OIDCAuthenticationFilter openIdConnectAuthenticationFilter() throws Exception {
OIDCAuthenticationFilter oidc = new OIDCAuthenticationFilter();
oidc.setAuthenticationManager(authenticationManagerBean());
oidc.setIssuerService(staticSingleIssuerService());
oidc.setServerConfigurationService(staticServerConfigurationService());
oidc.setClientConfigurationService(staticClientConfigurationService());
oidc.setAuthRequestOptionsService(staticAuthRequestOptionsService());
oidc.setAuthRequestUrlBuilder(plainAuthRequestUrlBuilder());
oidc.setAuthenticationSuccessHandler(frontEndRedirect());
return oidc;
}
@Bean
public StaticSingleIssuerService staticSingleIssuerService(){
StaticSingleIssuerService staticSingleIssuerService = new StaticSingleIssuerService();
staticSingleIssuerService.setIssuer(oidcIssuer);
return staticSingleIssuerService;
}
@Bean(initMethod = "init")
public FrontEndLinkURIAuthenticationSuccessHandler frontEndRedirect(){
FrontEndLinkURIAuthenticationSuccessHandler frontEnd = new FrontEndLinkURIAuthenticationSuccessHandler();
frontEnd.setFrontEndURI(webAppFrontEnd);
return frontEnd;
}
}

View File

@ -52,4 +52,5 @@ public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer imple
this.properties = properties;
}
}
}

View File

@ -0,0 +1,59 @@
package eu.dnetlib.repo.manager.config;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
public class DatasourceConfiguration {
private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class);
@Value("${repomanager.db.driverClassName}")
private String driverClassname;
@Value("${repomanager.db.url}")
private String URL;
@Value("${repomanager.db.username}")
private String username;
@Value("${repomanager.db.password}")
private String password;
@Bean
public BasicDataSource dataSource(){
BasicDataSource basicDataSource = new BasicDataSource();
basicDataSource.setDriverClassName(driverClassname);
basicDataSource.setUrl(URL);
basicDataSource.setUsername(username);
basicDataSource.setPassword(password);
basicDataSource.setMaxIdle(10);
basicDataSource.setMaxActive(100);
basicDataSource.setMaxWait(1000);
basicDataSource.setValidationQuery("SELECT 1;");
basicDataSource.setTestOnBorrow(true);
basicDataSource.setTestOnReturn(true);
basicDataSource.setTestWhileIdle(true);
basicDataSource.setTimeBetweenEvictionRunsMillis(1200000);
basicDataSource.setMinEvictableIdleTimeMillis(1800000);
basicDataSource.setMinEvictableIdleTimeMillis(5);
basicDataSource.setPoolPreparedStatements(true);
basicDataSource.setDefaultAutoCommit(true);
return basicDataSource;
}
@Bean
public DataSourceTransactionManager txManager(){
DataSourceTransactionManager txManager = new DataSourceTransactionManager();
txManager.setDataSource(dataSource());
return txManager;
}
}

View File

@ -0,0 +1,19 @@
package eu.dnetlib.repo.manager.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true,proxyTargetClass = true)
public class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {
@Bean
public CommonsMultipartResolver multipartResolver(){
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(268435456);
return multipartResolver;
}
}

View File

@ -0,0 +1,79 @@
package eu.dnetlib.repo.manager.config;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.context.annotation.*;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
@Configuration
@EnableRedisHttpSession
@EnableAspectJAutoProxy
@EnableCircuitBreaker
@PropertySource(value = {"classpath:application.properties"} )
@ComponentScan(basePackages = {
"org.eurocris.openaire.cris.validator.service",
"eu.dnetlib.repo.manager.*"})
public class RedisConfiguration {
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
@Value("${redis.host}")
private String host;
@Value("${redis.port:6379}")
private String port;
@Value("${redis.password}")
private String password;
@Value("${aai.mode}")
private String aai_mode;
@PostConstruct
private void init(){
LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
}
@Bean
public JedisConnectionFactory connectionFactory() {
LOGGER.info(String.format("Redis : %s Port : %s Password : %s",host,port,password));
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
jedisConnectionFactory.setHostName(host);
jedisConnectionFactory.setPort(Integer.parseInt(port));
jedisConnectionFactory.setUsePool(true);
if(password != null) jedisConnectionFactory.setPassword(password);
return jedisConnectionFactory;
}
@Bean
public CookieSerializer cookieSerializer() {
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
serializer.setCookieName("openAIRESession");
serializer.setCookiePath("/");
if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta"))
serializer.setDomainName(".openaire.eu");
// serializer.setDomainName(".athenarc.gr");
LOGGER.info("Serializer : " + serializer);
return serializer;
}
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("Content-Type", "application/json");
return restTemplate;
}
}

View File

@ -32,7 +32,6 @@ import java.util.Map;
@Service("piwikService")
public class PiWikServiceImpl implements PiWikService {
@Qualifier("repomanager.dataSource")
@Autowired
private DataSource dataSource;

View File

@ -8,7 +8,6 @@
<context:annotation-config/>
<context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/>
<tx:annotation-driven transaction-manager="txManager"/>
<bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
id="propertyLoader">
@ -29,39 +28,15 @@
<value>classpath*:/application.properties</value>
<value>classpath*:email-texts.properties</value>
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
<!-- <value>classpath*:dnet-site-override.properties</value>-->
<!-- <value>classpath*:dnet-wizard.properties</value>-->
<!-- <value>classpath*:dnet-override.properties</value>-->
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
<!-- <value>classpath*:dnet-force-override.properties</value>-->
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
<!-- <value>classpath*:dnet-site-override.properties</value>-->
<!-- <value>classpath*:dnet-wizard.properties</value>-->
<!-- <value>classpath*:dnet-override.properties</value>-->
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
<!-- <value>classpath*:dnet-force-override.properties</value>-->
</list>
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
</beans>

View File

@ -141,7 +141,7 @@ oidc.secret=AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
search.api.usagestats=https://services.openaire.eu/usagestats
search.api.usageEvents=http://beta.lbs.openaire.eu:8080/ajax/summary
api.baseAddress=http://beta.services.openaire.eu/openaire
api.baseAddress=https://dev-openaire.d4science.org/openaire
services.repo-manager.baseUrl=http://${container.hostname}:${container.port}/${container.context}
services.repo-manager.adminEmail=antleb@di.uoa.gr
services.repo-manager.repository.testing.mode=false

View File

@ -1,157 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.1.xsd"
default-autowire="byType">
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="268435456"/>
</bean>
<!--<bean id="webexpressionHandler"
class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>-->
<security:global-method-security pre-post-annotations="enabled" proxy-target-class="true" authentication-manager-ref="authenticationManager"/>
<security:http auto-config="false" use-expressions="true"
disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
pattern="/**">
<security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
<security:logout logout-url="/openid_logout" invalidate-session="true"
delete-cookies="openAIRESession" logout-success-url="${webapp.dev.front}"/>
</security:http>
<bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
<constructor-arg type="java.lang.String" value="/openid_connect_login"/>
</bean>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="openIdConnectAuthenticationProvider" />
</security:authentication-manager>
<bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
<property name="authoritiesMapper">
<bean class="eu.dnetlib.repo.manager.config.OpenAireProviderAuthoritiesMapper">
<constructor-arg name="userRoles" ref="userRoles"/>
</bean>
</property>
</bean>
<util:map id="userRoles">
<entry key="urn:geant:openaire.eu:group:Super+Administrator#aai.openaire.eu" value="ROLE_ADMIN"/>
<entry key="urn:geant:openaire.eu:group:Content+Provider+Dashboard+Administrator#aai.openaire.eu" value="ROLE_PROVIDE_ADMIN"/>
</util:map>
<bean class="eu.dnetlib.repo.manager.config.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect"
init-method="init">
<property name="frontEndURI" value="${webapp.dev.front}"/>
</bean>
<!--
-
- The authentication filter
-
-->
<bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="issuerService" ref="staticIssuerService" />
<property name="serverConfigurationService" ref="staticServerConfigurationService" />
<property name="clientConfigurationService" ref="staticClientConfigurationService" />
<property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
<property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
<property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
</bean>
<!--
Static issuer service, returns the same issuer for every request.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
<property name="issuer" value="${oidc.issuer}" />
</bean>
<!--
Dynamic server configuration, fetches the server's information using OIDC Discovery.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
<property name="servers">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.openid.connect.config.ServerConfiguration">
<property name="issuer" value="${oidc.issuer}" />
<property name="authorizationEndpointUri" value="${oidc.issuer}authorize" />
<property name="tokenEndpointUri" value="${oidc.issuer}token" />
<property name="userInfoUri" value="${oidc.issuer}userinfo" />
<property name="jwksUri" value="${oidc.issuer}jwk" />
<property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
</bean>
</entry>
</map>
</property>
</bean>
<!--
Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
<property name="clients">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.oauth2.model.RegisteredClient">
<property name="clientId" value="${oidc.id}" />
<property name="clientSecret" value="${oidc.secret}" />
<property name="scope">
<set value-type="java.lang.String">
<value>openid</value>
</set>
</property>
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>${oidc.dev.home}</value>
</set>
</property>
</bean>
</entry>
</map>
</property>
</bean>
<!--
-
- Auth request options service: returns the optional components of the request
-
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
<property name="options">
<map>
<!-- Entries in this map are sent as key-value parameters to the auth request -->
<!--
<entry key="display" value="page" />
<entry key="max_age" value="30" />
<entry key="prompt" value="none" />
-->
</map>
</property>
</bean>
<!--
Plain authorization request builder, puts all options as query parameters on the GET request
-->
<bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
</beans>

View File

@ -67,31 +67,6 @@
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<bean class="eu.dnetlib.repo.manager.config.SwaggerConfig"/>

View File

@ -9,7 +9,6 @@
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
/WEB-INF/aai-security.xml
</param-value>
</context-param>
<context-param>

View File

@ -8,7 +8,6 @@
<context:annotation-config/>
<context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/>
<tx:annotation-driven transaction-manager="txManager"/>
<bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
id="propertyLoader">
@ -27,41 +26,17 @@
<value>classpath*:/eu/**/springContext-*.properties</value>
<value>classpath*:/application.properties</value>
<value>classpath*:/email-texts.properties</value>
<value>classpath*:email-texts.properties</value>
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
<!-- <value>classpath*:dnet-site-override.properties</value>-->
<!-- <value>classpath*:dnet-wizard.properties</value>-->
<!-- <value>classpath*:dnet-override-new.properties</value>-->
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
<!-- <value>classpath*:dnet-force-override.properties</value>-->
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
<!-- <value>classpath*:dnet-site-override.properties</value>-->
<!-- <value>classpath*:dnet-wizard.properties</value>-->
<!-- <value>classpath*:dnet-override.properties</value>-->
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
<!-- <value>classpath*:dnet-force-override.properties</value>-->
</list>
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
</beans>

View File

@ -67,33 +67,4 @@
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<bean class="eu.dnetlib.repo.manager.config.SwaggerConfig"/>
</beans>