Skip to content

Commit

Permalink
automatic project update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubois committed Oct 28, 2016
1 parent b62fd1d commit f539633
Show file tree
Hide file tree
Showing 50 changed files with 149 additions and 1,756 deletions.
32 changes: 16 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
######################
# Node
######################
/node/**
/node_tmp/**
/node_modules/**
node/
node_tmp/
node_modules/

######################
# SASS
######################
.sass-cache/**
.sass-cache/

######################
# Eclipse
######################
*.pydevproject
.project
.metadata
/tmp/**
/tmp/**/*
tmp/
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/**
.settings/
.loadpath
/src/main/resources/rebel.xml

Expand All @@ -48,7 +48,7 @@ local.properties
######################
# Intellij
######################
.idea/**
.idea/
*.iml
*.iws
*.ipr
Expand All @@ -58,18 +58,18 @@ local.properties
######################
# Visual Studio Code
######################
.vscode/**
.vscode/

######################
# Maven
######################
/log/**
/target/**
log/
target/

######################
# Gradle
######################
.gradle/**
.gradle/

######################
# Package Files
Expand Down Expand Up @@ -104,10 +104,10 @@ Desktop.ini
######################
# Directories
######################
/build/**
/bin/**
/spring_loaded/**
/deploy/**
build/
bin/
spring_loaded/
deploy/

######################
# Logs
Expand Down
2 changes: 1 addition & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"en"
],
"serverPort": 8080,
"jhipsterVersion": "3.9.1",
"jhipsterVersion": "3.10.0",
"enableSocialSignIn": false,
"useSass": false,
"jhiPrefix": "jhi",
Expand Down
1 change: 1 addition & 0 deletions gulp/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
function app() {
return gulp.src(config.app + 'index.html')
.pipe(inject(gulp.src(config.app + 'app/**/*.js')
.pipe(plumber({errorHandler: handleErrors}))
.pipe(naturalSort())
.pipe(angularFilesort()), {relative: true}))
.pipe(gulp.dest(config.app));
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated on 2016-10-11 using generator-jhipster 3.9.1
// Generated on 2016-10-28 using generator-jhipster 3.10.0
'use strict';

var gulp = require('gulp'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.3.1",
"event-stream": "3.3.4",
"generator-jhipster": "3.9.1",
"generator-jhipster": "3.10.0",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "2.0.0",
Expand Down
20 changes: 8 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<metrics-spring.version>3.1.3</metrics-spring.version>
<logstash-logback-encoder.version>4.7</logstash-logback-encoder.version>
<run.addResources>false</run.addResources>
<spring-security.version>4.1.0.RELEASE</spring-security.version>
<spring-security.version>4.1.3.RELEASE</spring-security.version>
<springfox.version>2.5.0</springfox.version>
<!-- Sonar properties -->
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
Expand Down Expand Up @@ -163,6 +163,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>com.mattbertolini</groupId>
<artifactId>liquibase-slf4j</artifactId>
Expand Down Expand Up @@ -214,7 +219,6 @@
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
<!-- include netty handler explicitly to overcome dependency mismatch when using cassandra -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
Expand Down Expand Up @@ -355,16 +359,8 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-localconfig-connector</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
</dependency>
<!-- security -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.*;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.util.Assert;

import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.metamodel.EntityType;
import javax.persistence.metamodel.PluralAttribute;
import java.util.Set;
import java.util.SortedSet;
import java.util.stream.Stream;

@SuppressWarnings("unused")
@Configuration
Expand Down Expand Up @@ -51,30 +48,12 @@ public CacheManager cacheManager(JHipsterProperties jHipsterProperties) {
cacheManager = net.sf.ehcache.CacheManager.create();
cacheManager.getConfiguration().setMaxBytesLocalHeap(jHipsterProperties.getCache().getEhcache().getMaxBytesLocalHeap());
log.debug("Registering Ehcache Metrics gauges");
Set<EntityType<?>> entities = entityManager.getMetamodel().getEntities();
for (EntityType<?> entity : entities) {
String name = entity.getName();
if (name == null || entity.getJavaType() != null) {
name = entity.getJavaType().getName();
}
Assert.notNull(name, "entity cannot exist without an identifier");
reconfigureCache(name, jHipsterProperties);
for (PluralAttribute pluralAttribute : entity.getPluralAttributes()) {
reconfigureCache(name + "." + pluralAttribute.getName(), jHipsterProperties);
}
}
Stream.of(cacheManager.getCacheNames()).forEach(name -> {
net.sf.ehcache.Cache cache = cacheManager.getCache(name);
cacheManager.replaceCacheWithDecoratedCache(cache, InstrumentedEhcache.instrument(metricRegistry, cache));
});
EhCacheCacheManager ehCacheManager = new EhCacheCacheManager();
ehCacheManager.setCacheManager(cacheManager);
return ehCacheManager;
}

private void reconfigureCache(String name, JHipsterProperties jHipsterProperties) {
net.sf.ehcache.Cache cache = cacheManager.getCache(name);
if (cache != null) {
cache.getCacheConfiguration().setTimeToLiveSeconds(jHipsterProperties.getCache().getTimeToLiveSeconds());
net.sf.ehcache.Ehcache decoratedCache = InstrumentedEhcache.instrument(metricRegistry, cache);
cacheManager.replaceCacheWithDecoratedCache(cache, decoratedCache);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class DefaultProfileUtil {

private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default";

private DefaultProfileUtil(){
private DefaultProfileUtil() {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,8 @@ public void setTimeToLiveInDays(int timeToLiveInDays) {
}

public static class Cache {

private int timeToLiveSeconds = 3600;

private final Ehcache ehcache = new Ehcache();

public int getTimeToLiveSeconds() {
return timeToLiveSeconds;
}

public void setTimeToLiveSeconds(int timeToLiveSeconds) {
this.timeToLiveSeconds = timeToLiveSeconds;
}

public Ehcache getEhcache() {
return ehcache;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package io.github.jhipster.sample.config;

import ch.qos.logback.classic.AsyncAppender;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.LoggerContextListener;
import ch.qos.logback.core.spi.ContextAwareBase;
import net.logstash.logback.appender.LogstashSocketAppender;
import net.logstash.logback.stacktrace.ShortenedThrowableConverter;
import org.slf4j.Logger;
Expand Down Expand Up @@ -32,11 +35,16 @@ public class LoggingConfiguration {
@PostConstruct
private void init() {
if (jHipsterProperties.getLogging().getLogstash().isEnabled()) {
addLogstashAppender();
addLogstashAppender(context);

// Add context listener
LogbackLoggerContextListener loggerContextListener = new LogbackLoggerContextListener();
loggerContextListener.setContext(context);
context.addListener(loggerContextListener);
}
}

public void addLogstashAppender() {
public void addLogstashAppender(LoggerContext context) {
log.info("Initializing Logstash logging");

LogstashSocketAppender logstashAppender = new LogstashSocketAppender();
Expand Down Expand Up @@ -67,4 +75,37 @@ public void addLogstashAppender() {

context.getLogger("ROOT").addAppender(asyncLogstashAppender);
}


/**
* Logback configuration is achieved by configuration file and API.
* When configuration file change is detected, the configuration is reset.
* This listener ensures that the programmatic configuration is also re-applied after reset.
*/
class LogbackLoggerContextListener extends ContextAwareBase implements LoggerContextListener {

@Override
public boolean isResetResistant() {
return true;
}

@Override
public void onStart(LoggerContext context) {
addLogstashAppender(context);
}

@Override
public void onReset(LoggerContext context) {
addLogstashAppender(context);
}

@Override
public void onStop(LoggerContext context) {
}

@Override
public void onLevelChange(ch.qos.logback.classic.Logger logger, Level level) {
}
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.jhipster.sample.config;

import io.github.jhipster.sample.security.*;
import io.github.jhipster.sample.web.filter.CsrfCookieGeneratorFilter;
import io.github.jhipster.sample.config.JHipsterProperties;

import org.springframework.beans.factory.BeanInitializationException;
Expand All @@ -19,7 +18,7 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;

import javax.inject.Inject;

Expand Down Expand Up @@ -82,10 +81,9 @@ public void configure(WebSecurity web) throws Exception {
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.addFilterAfter(new CsrfCookieGeneratorFilter(), CsrfFilter.class)
.exceptionHandling()
.accessDeniedHandler(new CustomAccessDeniedHandler())
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.rememberMe()
Expand All @@ -104,7 +102,6 @@ protected void configure(HttpSecurity http) throws Exception {
.logout()
.logoutUrl("/api/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler)
.deleteCookies("JSESSIONID", "CSRF-TOKEN")
.permitAll()
.and()
.headers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
@Configuration
@EnableSwagger2
@Import(springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration.class)
@Profile(Constants.SPRING_PROFILE_SWAGGER)
public class SwaggerConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public interface UserRepository extends JpaRepository<User, Long> {

Optional<User> findOneByLogin(String login);

Optional<User> findOneById(Long userId);

@Query(value = "select distinct user from User user left join fetch user.authorities",
countQuery = "select count(user) from User user")
Page<User> findAllWithAuthorities(Pageable pageable);
Expand Down
Loading

0 comments on commit f539633

Please sign in to comment.