In addition to the answers, the omitted sharing class behaves as with sharing
when it is called from the Lightning Web component. I have tried and tested this with the below code.
public class DefaultSharing {
@AuraEnabled(cacheable=true)
public static List<Application__c> getApplications() {
return [SELECT Name, Owner.Name FROM Application__c];
}
}
import { LightningElement, wire } from "lwc";
import getApplicationsDefaultSharing from "@salesforce/apex/DefaultSharing.getApplications";
//...
export default class ApexSharingDemo extends LightningElement {
appsDefaultSharing = [];
@wire(getApplicationsDefaultSharing, {})
getApplicationsDefaultSharing({ error, data }) {
if (error) {
console.log("Error getting data", error);
} else if (data) {
this.appsDefaultSharing = [...data];
}
}
}