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
@Component | |
@Service | |
public class CacheServiceImpl implements CacheService { | |
@Activate | |
void onActivate() { | |
URL url = getClass().getResource("/ehcache.xml"); | |
cacheManager = CacheManager.create(url); | |
registerMBeans(); | |
cacheManager.clearAll(); |
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
@Component | |
@Service | |
public class SimpleDepartmentService implements DepartmentService { | |
/** | |
* Cache service. | |
*/ | |
@Reference | |
private CacheService cacheService; | |
/** |
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
@Component | |
@Service | |
public class CacheServiceImpl implements CacheService { | |
@Override | |
public void addToCache(final String cacheName, final String itemId, final Object item) { | |
// Do not save any null key or item | |
if (!contains(itemId, "null") && item != null) { | |
Ehcache cache = cacheManager.getEhcache(cacheName); | |
if (cache != null) { | |
Element element = new Element(itemId, item); |
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
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" | |
monitoring="autodetect" dynamicConfig="true"> | |
<!-- Sample cache named cache1 | |
This cache contains a maximum in memory of 10000 elements, and will expire | |
an element if it is idle for more than 5 minutes and lives for more than | |
10 minutes. | |
If there are more than 10000 elements it will overflow to the |
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
<build> | |
<plugins> | |
<groupId>org.apache.felix</groupId> | |
<artifactId>maven-bundle-plugin</artifactId> | |
<extensions>true</extensions> | |
<Embed-Dependency> | |
………,ehcache</Embed-Dependency> | |
</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> | |
<groupId>net.sf.ehcache</groupId> | |
<artifactId>ehcache</artifactId> | |
<version>2.10.2.2.21</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.servicemix.bundles</groupId> | |
<artifactId>org.apache.servicemix.bundles.ehcache</artifactId> | |
<version>2.6.5_1</version> | |
<scope>provided</scope> |
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
$(function () { | |
var url = window.location.protocol + "//" + window.location.host; | |
if (window.location.pathname.indexOf('/api') > 0) { | |
url += window.location.pathname.substring(0, window.location.pathname.indexOf('/api')) | |
} | |
url += "/api-docs"; | |
log('API URL: ' + apiUrl); | |
window.swaggerUi = new SwaggerUi({}) | |
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
@RequestMapping(value = “/product”, produces = “application/json”) | |
@ResponseBody | |
@ApiOperation(value = "Product List", notes = "List by Category") | |
final ProductList getProducts() |
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
import com.mangofactory.swagger.configuration.SpringSwaggerConfig; | |
import com.mangofactory.swagger.plugin.EnableSwagger; | |
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin; | |
import com.wordnik.swagger.model.ApiInfo; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import java.util.List; |
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> | |
<groupId>com.mangofactory</groupId> | |
<artifactId>swagger-springmvc</artifactId> | |
<version>0.9.1</version> | |
</dependency> |
NewerOlder