Skip to content

Commit 0692e25

Browse files
phasenraum2010phasenraum2010
authored andcommitted
small refactoring...
1 parent ab281de commit 0692e25

File tree

21 files changed

+155
-37
lines changed

21 files changed

+155
-37
lines changed

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
addons:
5+
apt:
6+
packages:
7+
- oracle-java8-installer
8+
services:
9+
- postgresql
10+
before_install:
11+
- sudo apt-get update
12+
- sudo apt-get install language-pack-de
13+
- sudo /etc/init.d/postgresql stop
14+
- sudo /etc/init.d/postgresql start 9.6
15+
before_script:
16+
- psql -c "CREATE USER jdbc WITH PASSWORD 'jdbcpwd' LOGIN SUPERUSER INHERIT CREATEDB CREATEROLE NOREPLICATION;" -U postgres
17+
- psql -c 'GRANT pg_signal_backend, postgres TO jdbc WITH ADMIN OPTION;' -U postgres
18+
- psql -c "CREATE DATABASE jdbc WITH OWNER = jdbc TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'de_DE.UTF-8' LC_CTYPE = 'de_DE.UTF-8' CONNECTION LIMIT = -1;" -U postgres
19+
- psql -c '\l' -U postgres
20+
- psql -c '\dg' -U postgres
21+
- psql -c '\dn' -U postgres
22+
- psql -c 'select * from version();' -U postgres
23+
- psql -c 'select * from version();' -U jdbc
24+
sudo: false
25+
script: ./mvnw clean site site:deploy -Ptravis -Dtest=MyTestSuiteForTravis -B -V

_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
theme: jekyll-theme-slate
2+
title: btw17 Kandidaten
3+
description: Kandidaten fuer die Bundestagswahl 2017
4+
google_analytics: UA-17174370-7
5+

src/main/java/org/woehlke/learn/learnneo4j/configuration/StartupListener.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import org.springframework.context.ApplicationListener;
77
import org.springframework.context.event.ContextRefreshedEvent;
88
import org.springframework.stereotype.Component;
9+
import org.woehlke.learn.learnneo4j.configuration.properties.MyAppProperties;
10+
import org.woehlke.learn.learnneo4j.configuration.properties.OtherAppProperties;
11+
import org.woehlke.learn.learnneo4j.configuration.properties.SpringAppProperties;
912
import org.woehlke.learn.learnneo4j.model.graph.Category;
1013
import org.woehlke.learn.learnneo4j.model.graph.category.CategoryRepository;
1114

@@ -16,9 +19,18 @@ public class StartupListener implements ApplicationListener<ContextRefreshedEven
1619

1720
private final CategoryRepository categoryRepository;
1821

22+
private final MyAppProperties myAppProperties;
23+
24+
private final OtherAppProperties otherAppProperties;
25+
26+
private final SpringAppProperties springAppProperties;
27+
1928
@Autowired
20-
public StartupListener(CategoryRepository categoryRepository) {
29+
public StartupListener(CategoryRepository categoryRepository, MyAppProperties myAppProperties, OtherAppProperties otherAppProperties, SpringAppProperties springAppProperties) {
2130
this.categoryRepository = categoryRepository;
31+
this.myAppProperties = myAppProperties;
32+
this.otherAppProperties = otherAppProperties;
33+
this.springAppProperties = springAppProperties;
2234
}
2335

2436
@Override
@@ -41,5 +53,9 @@ public void onApplicationEvent(ContextRefreshedEvent event) {
4153
log.info("Category found with findByCategory('www'):");
4254
log.info("--------------------------------");
4355
log.info(this.categoryRepository.findByName("www").toString());
56+
log.info("--------------------------------");
57+
log.info(myAppProperties.toString());
58+
log.info(myAppProperties.toString());
59+
log.info(myAppProperties.toString());
4460
}
4561
}

src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/MyProperties.java renamed to src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/MyAppProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@Component
1212
@Validated
1313
@ConfigurationProperties(prefix="org.woehlke.learn.learnneo4j")
14-
public class MyProperties {
14+
public class MyAppProperties {
1515

1616
@NotNull
1717
private String filesystemWorkdir;

src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/OtherProperties.java renamed to src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/OtherAppProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@Component
1313
@Validated
1414
@ConfigurationProperties
15-
public class OtherProperties {
15+
public class OtherAppProperties {
1616

1717
@Valid
1818
private Server server = new Server();

src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/SpringProperties.java renamed to src/main/java/org/woehlke/learn/learnneo4j/configuration/properties/SpringAppProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@Component
1414
@Validated
1515
@ConfigurationProperties(prefix="spring")
16-
public class SpringProperties {
16+
public class SpringAppProperties {
1717

1818
@NotNull
1919
private String profiles;

src/main/java/org/woehlke/learn/learnneo4j/configuration/spring/WebMvcConfig.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
1616
@Override
1717
public void addViewControllers(ViewControllerRegistry registry) {
1818
registry.addViewController("/").setViewName("redirect:/welcome");
19-
registry.addViewController("/adm").setViewName("redirect:/report/overview");
20-
registry.addViewController("/regierung/kanzleramt").setViewName("redirect:/ministerium/15");
19+
registry.addViewController("/adm").setViewName("redirect:/adm/overview");
2120
}
2221

2322
@Override
2423
public void addResourceHandlers(ResourceHandlerRegistry registry) {
25-
registry.addResourceHandler("/css/*").addResourceLocations("classpath:/public/css/");
26-
registry.addResourceHandler("/css/**").addResourceLocations("classpath:/public/css/");
27-
registry.addResourceHandler("/icon/*").addResourceLocations("classpath:/public/icon/");
28-
registry.addResourceHandler("/icon/**").addResourceLocations("classpath:/public/icon/");
29-
registry.addResourceHandler("/img/*").addResourceLocations("classpath:/public/img/");
30-
registry.addResourceHandler("/img/**").addResourceLocations("classpath:/public/img/");
31-
registry.addResourceHandler("/js/*").addResourceLocations("classpath:/public/js/");
32-
registry.addResourceHandler("/js/**").addResourceLocations("classpath:/public/js/");
33-
registry.addResourceHandler("/map-icons/*").addResourceLocations("classpath:/public/map-icons/");
34-
registry.addResourceHandler("/map-icons/**").addResourceLocations("classpath:/public/map-icons/");
24+
registry.addResourceHandler("/css/*").addResourceLocations("classpath:/static/css/");
25+
registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
26+
registry.addResourceHandler("/icon/*").addResourceLocations("classpath:/static/icon/");
27+
registry.addResourceHandler("/icon/**").addResourceLocations("classpath:/static/icon/");
28+
registry.addResourceHandler("/img/*").addResourceLocations("classpath:/static/img/");
29+
registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/img/");
30+
registry.addResourceHandler("/js/*").addResourceLocations("classpath:/static/js/");
31+
registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
32+
registry.addResourceHandler("/map-icons/*").addResourceLocations("classpath:/static/map-icons/");
33+
registry.addResourceHandler("/map-icons/**").addResourceLocations("classpath:/static/map-icons/");
3534
registry.addResourceHandler("/webjars/*").addResourceLocations("/webjars/");
3635
registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/");
3736
}

src/main/java/org/woehlke/learn/learnneo4j/configuration/spring/WebSecurityConfig.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
99
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
1010
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
11-
import org.woehlke.learn.learnneo4j.configuration.properties.MyProperties;
11+
import org.woehlke.learn.learnneo4j.configuration.properties.MyAppProperties;
1212

1313
@Configuration
1414
@EnableSpringDataWebSupport
@@ -20,7 +20,7 @@ protected void configure(HttpSecurity http) throws Exception {
2020
http
2121
.authorizeRequests()
2222
.antMatchers(
23-
myProperties.getWebSecurityConfigPublicPathsAsArray()
23+
myAppProperties.getWebSecurityConfigPublicPathsAsArray()
2424
)
2525
.permitAll()
2626
.anyRequest().authenticated()
@@ -39,20 +39,19 @@ protected void configure(HttpSecurity http) throws Exception {
3939

4040
@Autowired
4141
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
42-
String user = myProperties.getLoginUsername();
43-
String pwd = myProperties.getLoginPassword();
42+
String user = myAppProperties.getLoginUsername();
43+
String pwd = myAppProperties.getLoginPassword();
4444
String role = "USER";
4545
auth
4646
.inMemoryAuthentication()
4747
.withUser(user).password(pwd).roles(role);
4848
}
4949

50-
5150
@Autowired
52-
public WebSecurityConfig(MyProperties myProperties) {
53-
this.myProperties = myProperties;
51+
public WebSecurityConfig(MyAppProperties myAppProperties) {
52+
this.myAppProperties = myAppProperties;
5453
}
5554

56-
private final MyProperties myProperties;
55+
private final MyAppProperties myAppProperties;
5756

5857
}

src/main/java/org/woehlke/learn/learnneo4j/model/graph/port/PortController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public PortController(PortService portService) {
2222
this.portService = portService;
2323
}
2424

25-
2625
@ModelAttribute("title")
2726
public String getTitle(){
2827
return "all Categories";

src/main/java/org/woehlke/learn/learnneo4j/model/orm/portinfo/PortinfoController.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ public class PortinfoController {
1414

1515
private static Logger log = LoggerFactory.getLogger(PortinfoController.class.getName());
1616

17-
//@ModelAttribute("title")
18-
//public String getTitle(){
19-
// return "Portinfo";
20-
//}
21-
2217
@GetMapping("/all")
2318
public String greeting(Model model) {
2419
model.addAttribute("all", portinfoService.findAll());

0 commit comments

Comments
 (0)