Compare commits

...

5 Commits

Author SHA1 Message Date
Paulo Gustavo Veiga 15325672a0 Move db initialization to beans. 2023-11-22 21:43:11 -08:00
Paulo Gustavo Veiga cd3d21f106 Move app.properties definition 2023-11-22 20:46:38 -08:00
Paulo Gustavo Veiga 12b0bb4866 Add missing message. 2023-11-22 20:29:10 -08:00
Paulo Gustavo Veiga 2c1e634a1a Fix log level for ValidationException 2023-11-22 20:23:52 -08:00
Paulo Gustavo Veiga 597e3ab165 Move security auth. 2023-11-22 16:50:56 -08:00
13 changed files with 162 additions and 124 deletions

View File

@ -20,10 +20,6 @@ import org.springframework.web.servlet.view.JstlView;
@ComponentScan
@ImportResource("classpath:spring/wisemapping-common.xml")
public class Application {
@Autowired
TransactionManager txManager;
@Bean
HandlerExceptionResolver errorHandler() {
final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver();

View File

@ -0,0 +1,88 @@
package com.wisemapping.config;
import org.apache.commons.dbcp2.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableTransactionManagement
public class HibernateConfig {
@Value("${database.hibernate.dialect}")
private String dbDialect;
@Value("${database.driver}")
private String dbDriver;
@Value("${database.url}")
private String dbUrl;
@Value("${database.username}")
private String dbUsername;
@Value("${database.password}")
private String dbPassword;
@Value("${database.validation.enabled:true}")
private boolean dbSetOnBorrow;
@Value("${database.validation.query:SELECT 1}")
private String dbValQuery;
@Bean
public LocalSessionFactoryBean sessionFactory() {
final LocalSessionFactoryBean result = new LocalSessionFactoryBean();
result.setPackagesToScan("com.wisemapping.model");
result.setDataSource(dataSource());
result.setHibernateProperties(hibernateProperties());
return result;
}
@Bean
public HibernateTransactionManager hibernateTransactionManager() {
final HibernateTransactionManager result = new HibernateTransactionManager();
result.setNestedTransactionAllowed(true);
// @Todo: Am I creatting two instances ???
result.setSessionFactory(sessionFactory().getObject());
return result;
}
private Properties hibernateProperties() {
final Properties result = new Properties();
result.setProperty("hibernate.dialect", dbDialect);
result.setProperty("hibernate.default_batch_fetch_size", "200");
result.setProperty("hibernate.nestedTransactionAllowed", "true");
result.setProperty("hibernate.auto_quote_keyword", "true");
return result;
}
@Bean
public DataSource dataSource() {
final BasicDataSource result = new BasicDataSource();
result.setDriverClassName(dbDriver);
result.setUrl(dbUrl);
result.setUsername(dbUsername);
result.setPassword(dbPassword);
result.setTestOnBorrow(dbSetOnBorrow);
result.setDefaultQueryTimeout(15);
result.setMaxTotal(100);
result.setMaxIdle(30);
result.setInitialSize(5);
result.setMaxWaitMillis(10000);
result.setValidationQuery(dbValQuery);
return result;
}
}

View File

@ -68,7 +68,7 @@ public class BaseController {
@ExceptionHandler(ValidationException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public RestErrors handleValidationErrors(@NotNull ValidationException ex) {
logger.error(ex.getMessage(), ex);
logger.debug(ex.getMessage(), ex);
return new RestErrors(ex.getErrors(), messageSource);
}

View File

@ -42,6 +42,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
@ -50,9 +51,8 @@ import java.util.stream.Collectors;
@Controller
@Transactional(propagation = Propagation.REQUIRED)
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
public class MindmapController extends BaseController {
final Logger logger = LogManager.getLogger();
private final Logger logger = LogManager.getLogger();
private static final String LATEST_HISTORY_REVISION = "latest";
@ -71,6 +71,8 @@ public class MindmapController extends BaseController {
@Value("${accounts.maxInactive:20}")
private int maxAccountsInactive;
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/json"})
@ResponseBody
public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException {
@ -79,6 +81,7 @@ public class MindmapController extends BaseController {
return new RestMindmap(mindMap, user);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json"})
public RestMindmapList retrieveList(@RequestParam(required = false) String q) {
final User user = Utils.getUser();
@ -92,6 +95,7 @@ public class MindmapController extends BaseController {
return new RestMindmapList(mindmaps, user);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/history/", produces = {"application/json"})
public RestMindmapHistoryList fetchHistory(@PathVariable int id) {
final List<MindMapHistory> histories = mindmapService.findMindmapHistory(id);
@ -102,27 +106,10 @@ public class MindmapController extends BaseController {
return result;
}
@RequestMapping(value = "/maps/{id}/history/{hid}", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
final Mindmap mindmap = findMindmapById(id);
final User user = Utils.getUser();
if (LATEST_HISTORY_REVISION.equals(hid)) {
// Revert to the latest stored version ...
List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
if (mindmapHistory.size() > 0) {
final MindMapHistory mindMapHistory = mindmapHistory.get(0);
mindmap.setZippedXml(mindMapHistory.getZippedXml());
saveMindmapDocument(true, mindmap, user);
}
} else {
mindmapService.revertChange(mindmap, Integer.parseInt(hid));
}
}
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws WiseMappingException, IOException {
final Mindmap mindmap = findMindmapById(id);
@ -150,6 +137,26 @@ public class MindmapController extends BaseController {
saveMindmapDocument(minor, mindmap, user);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(value = "/maps/{id}/history/{hid}", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
final Mindmap mindmap = findMindmapById(id);
final User user = Utils.getUser();
if (LATEST_HISTORY_REVISION.equals(hid)) {
// Revert to the latest stored version ...
List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
if (mindmapHistory.size() > 0) {
final MindMapHistory mindMapHistory = mindmapHistory.get(0);
mindmap.setZippedXml(mindMapHistory.getZippedXml());
saveMindmapDocument(true, mindmap, user);
}
} else {
mindmapService.revertChange(mindmap, Integer.parseInt(hid));
}
}
@PreAuthorize("permitAll()")
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/document/xml", "/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
@ResponseBody
@ -160,6 +167,7 @@ public class MindmapController extends BaseController {
return xmlStr.getBytes(StandardCharsets.UTF_8);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = {"/maps/{id}/document/xml"}, consumes = {"text/plain"})
@ResponseBody
public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException, IOException {
@ -171,6 +179,7 @@ public class MindmapController extends BaseController {
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
@ResponseBody
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
@ -182,6 +191,7 @@ public class MindmapController extends BaseController {
/**
* The intention of this method is the update of several properties at once ...
*/
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
@ -236,6 +246,7 @@ public class MindmapController extends BaseController {
return result;
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
@ -254,6 +265,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindMap, false);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions {
@ -303,6 +315,7 @@ public class MindmapController extends BaseController {
}
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, OwnerCannotChangeException {
@ -370,6 +383,7 @@ public class MindmapController extends BaseController {
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json"})
public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final Mindmap mindMap = findMindmapById(id);
@ -386,6 +400,7 @@ public class MindmapController extends BaseController {
return result;
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
@ -394,6 +409,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
@ -411,6 +427,7 @@ public class MindmapController extends BaseController {
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException {
@ -419,6 +436,7 @@ public class MindmapController extends BaseController {
mindmapService.removeMindmap(mindmap, user);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}/collabs")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws IOException, WiseMappingException {
@ -450,6 +468,7 @@ public class MindmapController extends BaseController {
}
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
@ -468,6 +487,7 @@ public class MindmapController extends BaseController {
mindmapService.updateCollaboration(user, collaboration.get());
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/starred", produces = {"text/plain"})
@ResponseBody
public String fetchStarred(@PathVariable int id) throws WiseMappingException {
@ -482,6 +502,7 @@ public class MindmapController extends BaseController {
return Boolean.toString(result);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/batch")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException {
@ -499,6 +520,7 @@ public class MindmapController extends BaseController {
}
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.POST, value = "/maps", consumes = {"application/xml", "application/json"})
@ResponseStatus(value = HttpStatus.CREATED)
public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException {
@ -534,6 +556,7 @@ public class MindmapController extends BaseController {
response.setHeader("ResourceId", Integer.toString(mindmap.getId()));
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/json"}, produces = {"application/json", "text/plain"})
@ResponseStatus(value = HttpStatus.CREATED)
public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
@ -561,19 +584,8 @@ public class MindmapController extends BaseController {
response.setHeader("ResourceId", Integer.toString(clonedMap.getId()));
}
private void saveMindmapDocument(boolean minor, @NotNull final Mindmap mindMap, @NotNull final User user) throws WiseMappingException {
final Calendar now = Calendar.getInstance();
mindMap.setLastModificationTime(now);
mindMap.setLastEditor(user);
mindmapService.updateMindmap(mindMap, !minor);
}
private ValidationException buildValidationException(@NotNull String fieldName, @NotNull String message) throws WiseMappingException {
final BindingResult result = new BeanPropertyBindingResult(new RestMindmap(), "");
result.rejectValue(fieldName, "error.not-specified", null, message);
return new ValidationException(result);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}/labels/{lid}")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void removeLabelFromMap(@PathVariable int id, @PathVariable int lid) throws WiseMappingException {
@ -589,6 +601,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/labels", consumes = {"application/json"})
@ResponseStatus(value = HttpStatus.OK)
public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException {
@ -603,6 +616,7 @@ public class MindmapController extends BaseController {
mindmapService.updateMindmap(mindmap, false);
}
@PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')")
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"})
public ResponseEntity<RestLockInfo> lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
final User user = Utils.getUser();
@ -620,6 +634,20 @@ public class MindmapController extends BaseController {
return result;
}
private void saveMindmapDocument(boolean minor, @NotNull final Mindmap mindMap, @NotNull final User user) throws WiseMappingException {
final Calendar now = Calendar.getInstance();
mindMap.setLastModificationTime(now);
mindMap.setLastEditor(user);
mindmapService.updateMindmap(mindMap, !minor);
}
private ValidationException buildValidationException(@NotNull String fieldName, @NotNull String message) throws WiseMappingException {
final BindingResult result = new BeanPropertyBindingResult(new RestMindmap(), "");
result.rejectValue(fieldName, "error.not-specified", null, message);
return new ValidationException(result);
}
private void verifyActiveCollabs(@NotNull RestCollaborationList restCollabs, User user) throws TooManyInactiveAccountsExceptions {
// Do not allow more than 20 new accounts per mindmap...
final List<Mindmap> userMindmaps = mindmapService.findMindmapsByUser(user);

View File

@ -67,4 +67,8 @@ ZOOM_IN=Приблизить
PASSWORD_TOO_LONG=Password must be less than 40 characters.
CHANGE_PASSWORD.EMAIL_SUBJECT=Your password has been reset
CHANGE_PASSWORD.EMAIL_TITLE=A temporal password has been generated
CHANGE_PASSWORD.EMAIL_BODY=<p>Someone, most likely you, requested a new password for your WiseMapping account. </p><p><strong>Here is your new password: {0} </strong></p><p>You can login clicking <a href="{1}/c/login">here</a>. We strongly encourage you to change the password as soon as possible.</p>
CHANGE_PASSWORD.EMAIL_BODY=<p>Someone, most likely you, requested a new password for your WiseMapping account. </p><p><strong>Here is your new password: {0} </strong></p><p>You can login clicking <a href="{1}/c/login">here</a>. We strongly encourage you to change the password as soon as possible.</p>
PASSWORD_CHANGED.EMAIL_SUBJECT=Your password has been changed
PASSWORD_CHANGED.EMAIL_TITLE=Your password has been changed successfully
PASSWORD_CHANGED.EMAIL_BODY=<p>This is only an notification that your password has been changed. No further action is required.</p>

View File

@ -1,20 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">-->
<!-- <property name="defaultEncoding" value="UTF-8"/>-->
<!-- <property name="basenames">-->
<!-- <list>-->
<!-- <value>messages</value>-->
<!-- </list>-->
<!-- </property>-->
<!-- </bean>-->
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
<import resource="wisemapping-datasource.xml"/>
<import resource="wisemapping-dao.xml"/>
<import resource="wisemapping-service.xml"/>
<import resource="wisemapping-servlet.xml"/>
</beans>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="mindmapSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="wiseDataSource"/>
<property name="annotatedClasses">
<list>
<value>com.wisemapping.model.User</value>
<value>com.wisemapping.model.Collaborator</value>
<value>com.wisemapping.model.Collaboration</value>
<value>com.wisemapping.model.Mindmap</value>
<value>com.wisemapping.model.Label</value>
<value>com.wisemapping.model.CollaborationProperties</value>
<value>com.wisemapping.model.AccessAuditory</value>
<value>com.wisemapping.model.MindMapHistory</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${database.hibernate.dialect}</prop>
<!-- <prop key="hibernate.cache.use_second_level_cache">true</prop>-->
<!-- <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>-->
<prop key="hibernate.default_batch_fetch_size">200</prop>
<prop key="hibernate.nestedTransactionAllowed">true</prop>
<prop key="hibernate.auto_quote_keyword">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="mindmapSessionFactory"/>
<property name="nestedTransactionAllowed" value="true"/>
</bean>
</beans>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="wiseDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${database.driver}"/>
<property name="url" value="${database.url}"/>
<property name="username" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="testOnBorrow" value="${database.validation.enabled:true}"/>
<property name="defaultQueryTimeout" value="15"/>
<property name="maxTotal" value="100"/>
<property name="maxIdle" value="30"/>
<property name="initialSize" value="5"/>
<property name="maxWaitMillis" value="10000"/>
<property name="validationQuery" value="${database.validation.query:SELECT 1}"/>
</bean>
<!-- Optional configuration for external connexion pool -->
<!-- <bean id="wiseDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" >-->
<!-- <property name="jndiName">-->
<!-- <value>java:comp/env/jdbc/wisemapping</value>-->
<!-- </property>-->
<!-- </bean>-->
</beans>

View File

@ -58,6 +58,4 @@
</list>
</property>
</bean>
<!-- Configuration Bean -->
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
</beans>

View File

@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd">
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.smtp.host}"/>

View File

@ -12,7 +12,6 @@
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.wisemapping"/>
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
<!-- Interceptors Registration -->
<mvc:interceptors>

View File

@ -52,7 +52,7 @@
</init-param>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>mindmapSessionFactory</param-value>
<param-value>sessionFactory</param-value>
</init-param>
</filter>