Skip to content

Commit 28ba121

Browse files
committed
feat: update spring boot
1 parent dc8e452 commit 28ba121

File tree

5 files changed

+13
-29
lines changed

5 files changed

+13
-29
lines changed

backend/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
limitations under the License.
1212
*/
1313
plugins {
14-
id 'org.springframework.boot' version '3.4.0'
14+
id 'org.springframework.boot' version '3.5.0'
1515
id 'io.spring.dependency-management' version '1.1.7'
1616
id 'java'
1717
}

backend/src/main/java/ch/xxx/manager/adapter/client/NewsFeedConnector.java

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public class NewsFeedConnector implements NewsFeedClient {
4141
private static final String SEEKING_ALPHA_URL = "https://seekingalpha.com/market_currents.xml";
4242
private static final String CNBC_FINANCE_URL = "https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000664";
4343
private static final String SEC_EDGAR_USGAAP = "https://www.sec.gov/Archives/edgar/usgaap.rss.xml";
44-
private static final String SEC_EDGAR_ICON = "https://www.sec.gov/favicon.icon";
4544
private static final Logger LOGGER = LoggerFactory.getLogger(NewsFeedConnector.class);
4645
private final RestClient restClient;
4746
private final XmlMapper xmlMapper;
@@ -65,11 +64,7 @@ public SyndFeed importCnbcFinanceNewsFeed() {
6564

6665
@Override
6766
public List<CompanyReportWrapper> importSecEdgarUsGaapNewsFeed() {
68-
//var result = this.loadFile(SEC_EDGAR_USGAAP, String.class);
69-
record ResultItem(String content, Boolean icon) {}
70-
var result = List.of(SEC_EDGAR_USGAAP, SEC_EDGAR_ICON).stream().parallel()
71-
.map(url -> new ResultItem(this.loadFile(url, String.class, SEC_EDGAR_ICON.equals(url)), SEC_EDGAR_ICON.equals(url)))
72-
.filter(item -> !item.icon).findFirst().map(item -> item.content).orElseThrow(() -> new IllegalStateException("No content found"));
67+
var result = this.loadFile(SEC_EDGAR_USGAAP, String.class);
7368
RssDto rssDto = null;
7469
try {
7570
rssDto = this.xmlMapper.readValue(result, RssDto.class);
@@ -87,24 +82,14 @@ record ResultItem(String content, Boolean icon) {}
8782

8883
@Override
8984
public byte[] loadCompanyReportZip(String url) {
90-
return this.loadFile(url, byte[].class, false);
85+
return this.loadFile(url, byte[].class);
9186
}
9287

93-
private <T> T loadFile(String url, Class<T> classType, Boolean icon) {
88+
private <T> T loadFile(String url, Class<T> classType) {
9489
var result = this.restClient.get().uri(url)
9590
.header("Accept-Encoding", "gzip, deflate")
9691
.header("Host", "www.sec.gov")
97-
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0")
98-
.header("Accept", icon ? "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
99-
.header("Accept-Language", "en-US,en;q=0.5")
100-
.header("Accept-Encoding", "gzip, deflate")
101-
.header("Connection", "keep-alive")
102-
.header(icon ? "Referer" : "Upgrade-Insecure-Requests", icon ? "https://www.sec.gov/Archives/edgar/usgaap.rss.xml" : "1")
103-
.header("Sec-Fetch-Dest", icon ? "image" : "document")
104-
.header("Sec-Fetch-Mode", icon ? "no-cors" : "navigate")
105-
.header("Sec-Fetch-Site", icon ? "same-origin" : "none")
106-
.header(icon ? "TE" : "Sec-Fetch-User", icon ? "trailers" : "?1")
107-
.header("Priority", icon ? "u=6" : "u=0, i")
92+
.header("User-Agent","Sven Loesekann [email protected]")
10893
.retrieve().body(classType);
10994
return result;
11095
}

backend/src/main/java/ch/xxx/manager/adapter/config/WebSecurityConfig.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.security.web.SecurityFilterChain;
2626
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
2727
import org.springframework.security.web.header.writers.XXssProtectionHeaderWriter.HeaderValue;
28-
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
2928

3029
import ch.xxx.manager.domain.utils.DataHelper;
3130
import ch.xxx.manager.usecase.service.JwtTokenService;
@@ -50,13 +49,13 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
5049
final String blockedPath = this.activeProfile.toLowerCase().contains("prod") ? DEVPATH : PRODPATH;
5150
HttpSecurity httpSecurity = http
5251
.authorizeHttpRequests(
53-
authorize -> authorize.requestMatchers(AntPathRequestMatcher.antMatcher("/rest/config/**"))
54-
.permitAll().requestMatchers(AntPathRequestMatcher.antMatcher("/rest/kedatest/**"))
55-
.permitAll().requestMatchers(AntPathRequestMatcher.antMatcher("/rest/auth/**"))
56-
.permitAll().requestMatchers(AntPathRequestMatcher.antMatcher("/rest/**"))
52+
authorize -> authorize.requestMatchers("/rest/config/**")
53+
.permitAll().requestMatchers("/rest/kedatest/**")
54+
.permitAll().requestMatchers("/rest/auth/**")
55+
.permitAll().requestMatchers("/rest/**")
5756
.hasAuthority(DataHelper.Role.USERS.toString())
58-
.requestMatchers(AntPathRequestMatcher.antMatcher(blockedPath)).denyAll())
59-
.authorizeHttpRequests(authorize -> authorize.requestMatchers(AntPathRequestMatcher.antMatcher("/**")).permitAll())
57+
.requestMatchers(blockedPath).denyAll())
58+
.authorizeHttpRequests(authorize -> authorize.requestMatchers("/**").permitAll())
6059
.csrf(myCsrf -> myCsrf.disable())
6160
.sessionManagement(mySm -> mySm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
6261
.headers(myHeaders -> myHeaders.contentSecurityPolicy(myCsp -> myCsp.policyDirectives(

backend/src/main/java/ch/xxx/manager/adapter/cron/CronJobService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class CronJobService {
4949
private final AppUserService appUserService;
5050
private final PortfolioService portfolioService;
5151
private final NewsFeedService newsFeedService;
52-
private Environment environment;
52+
private final Environment environment;
5353
@Value("${api.key}")
5454
private String apiKey;
5555

backend/src/main/java/ch/xxx/manager/usecase/service/NewsFeedService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void updateCnbcFinanceNewsFeed() {
7171
@Transactional
7272
public void importCompanyReports() {
7373
this.updateCompanyToSymbolJson();
74-
this.updateSecEdgarUsGaapNewsFeed();
74+
//this.updateSecEdgarUsGaapNewsFeed();
7575
}
7676

7777
private void updateSecEdgarUsGaapNewsFeed() {

0 commit comments

Comments
 (0)