This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-enforcer-plugin</artifactId> | |
<version>1.4.1</version> | |
<configuration> | |
<rules><dependencyConvergence/></rules> | |
</configuration> | |
</plugin> | |
</plugins> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dependency convergence error for log4j:log4j:1.2.17 paths to dependency are: | |
+-com.ricston.conflict:conflict-info:2.1.3-SNAPSHOT | |
+-org.slf4j:slf4j-log4j12:1.7.6 | |
+-log4j:log4j:1.2.17 | |
and | |
+-com.ricston.conflict:conflict-info:2.1.3-SNAPSHOT | |
+-log4j:log4j:1.2.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session session = sessionFactory | |
.withOptions() | |
.tenantIdentifier(yourTenantIdentifier) | |
... | |
.openSession(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PropertySource("classpath:/com/myco/app.properties") | |
@Configuration | |
public class ApplicationConfig { | |
@Autowired | |
Environment env; | |
//... | |
@Bean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* It lookup the correct datasource to use, we have one per tenant | |
* | |
* The tenant datasource has default properties from database.properties and | |
* also properties in database.{tenantId}.properties whose properties override | |
* the default ones. | |
* | |
* @author jose.mgmaestre | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* It specify what Tenant should be use when the hibernate session is created. | |
* @author jm | |
*/ | |
public class CurrentTenantIdentifierResolverImpl implements CurrentTenantIdentifierResolver { | |
Logger logger = Logger.getLogger(getClass()); | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* It gets the connection based on different datasources. | |
*/ | |
public class MultiTenantConnectionProviderImpl extends AbstractDataSourceBasedMultiTenantConnectionProviderImpl | |
{ | |
Log logger = LogFactory.getLog(getClass()); | |
private static final long serialVersionUID = 14535345L; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* It specify what Tenant should be used: | |
* <p> | |
* <p> | |
* There are 2 modes of resolving the identifier using {@link #resolveCurrentTenantIdentifier()}: | |
* | |
* <li> Using a global tenant identifier for junit testing | |
* <li> Using the http session to get the tenant for deployed applications | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration(locations = { "classpath:META-INF/spring/testContext.xml" }) | |
@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) | |
public class MultiTenantConnectionProviderTest { | |
... | |
@Autowired | |
MultiTenantConnectionProviderImpl multitenancyConnectionProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ricston.injectionexample.domain; | |
import com.ricston.injectionexample.domain.com.ricston.injectionexample.domain.blood.Blood; | |
import javax.inject.Inject; | |
public class Body { | |
@Inject | |
public Body(){} |
OlderNewer